100 atcoder#ABC109C. [ABC109C] Skip

[ABC109C] Skip

Score : 300300 points

Problem Statement

There are NN cities on a number line. The ii-th city is located at coordinate xix_i.

Your objective is to visit all these cities at least once.

In order to do so, you will first set a positive integer DD.

Then, you will depart from coordinate XX and perform Move 11 and Move 22 below, as many times as you like:

  • Move 11: travel from coordinate yy to coordinate y+Dy + D.
  • Move 22: travel from coordinate yy to coordinate yDy - D.

Find the maximum value of DD that enables you to visit all the cities.

Here, to visit a city is to travel to the coordinate where that city is located.

Constraints

  • All values in input are integers.
  • 1N1051 \leq N \leq 10^5
  • 1X1091 \leq X \leq 10^9
  • 1xi1091 \leq x_i \leq 10^9
  • xix_i are all different.
  • x1,x2,...,xNXx_1, x_2, ..., x_N \neq X

Input

Input is given from Standard Input in the following format:

NN XX

x1x_1 x2x_2 ...... xNx_N

Output

Print the maximum value of DD that enables you to visit all the cities.

3 3
1 7 11
2

Setting D=2D = 2 enables you to visit all the cities as follows, and this is the maximum value of such DD.

  • Perform Move 22 to travel to coordinate 11.
  • Perform Move 11 to travel to coordinate 33.
  • Perform Move 11 to travel to coordinate 55.
  • Perform Move 11 to travel to coordinate 77.
  • Perform Move 11 to travel to coordinate 99.
  • Perform Move 11 to travel to coordinate 1111.
3 81
33 105 57
24
1 1
1000000000
999999999