from fractions import gcd



N, X = [int(a) for a in input().split()]

x = [int(a) for a in input().split()]



x.sort()



if X < x[0]:

    d = x[0] - X

elif X > x[N - 1]:

    d = X - x[N - 1]

else:   # x[i] <= Xである最大のiを求める

    ok = 0      # x[0] <= Xを満たす

    ng = N - 1  # x[N - 1] > X

    while ng - ok > 1:

        mid = (ok + ng) // 2

        if x[mid] <= X:

            ok = mid

        else:

            ng = mid

    d = gcd(X - x[ok], x[ok + 1] - X)



for i in range(1, N):

    d = gcd(d, x[i] - x[i - 1])



print(d)

from fractions import gcd



N, X = [int(a) for a in input().split()]

x = [int(a) for a in input().split()]



d = abs(X - x[0])

for i in range(1, N):

    d = gcd(d, abs(x[i] - x[i - 1]))



print(d)

from fractions import gcd

N, X = [int(a) for a in input().split()]
x = [int(a) for a in input().split()]
x.sort()
if X < x[0]:
    d = x[0] - X
elif X > x[N - 1]:
    d = X - x[N - 1]
else:  # x[i] <= Xである最大のiを求める
    ok = 0  # x[0] <= Xを満たす
    ng = N - 1  # x[N - 1] > X
    while ng - ok > 1:
        mid = (ok + ng) // 2
        if x[mid] <= X:
            ok = mid
        else:
            ng = mid
    d = gcd(X - x[ok], x[ok + 1] - X)
for i in range(1, N):
    d = gcd(d, x[i] - x[i - 1])
print(d)

from fractions import gcd

N, X = [int(a) for a in input().split()]
x = [int(a) for a in input().split()]
d = abs(X - x[0])
for i in range(1, N):
    d = gcd(d, abs(x[i] - x[i - 1]))
print(d)

-x.sort() -if X < x[0]: -    d = x[0] - X -elif X > x[N - 1]: -    d = X - x[N - 1] -else:  # x[i] <= Xである最大のiを求める -    ok = 0  # x[0] <= Xを満たす -    ng = N - 1  # x[N - 1] > X -    while ng - ok > 1: -        mid = (ok + ng) // 2 -        if x[mid] <= X: -            ok = mid -        else: -            ng = mid -    d = gcd(X - x[ok], x[ok + 1] - X) +d = abs(X - x[0]) -    d = gcd(d, x[i] - x[i - 1]) +    d = gcd(d, abs(x[i] - x[i - 1]))