n,s = (int(i) for i in input().split())

x = list(int(i) for i in input().split())

x = sorted(x)

if n>1:

    dif = []

    for i in range(n-1):

        dif.append(x[i+1]-x[i])



    difs = []

    for i in range(n):

        difs.append(abs(s-x[i]))

    res = min(min(dif),min(difs))

    for i in range(res):

        flag = True

        for j in range(n-1):

            if dif[j]%(res-i)!=0:

                flag = False

                break

        if flag:

            res -= i

            break

                

    print(res)

else:

    print((abs(x[0]-s)))
N, X = list(map(int, input().split()))

x = list(map(int, input().split()))

x.sort()

dist = [abs(x[0]-X)]

for i in range(N - 1):

    dist.append(x[i + 1] - x[i])



# dist内の最大公約数を求めればよい

def gcd(a, b):

    if b == 0:

        return a

    else:

        return gcd(b, a % b)

res = dist[0]

for i in range(1, N):

    res = gcd(res, dist[i])



print(res)
n, s = (int(i) for i in input().split())
x = list(int(i) for i in input().split())
x = sorted(x)
if n > 1:
    dif = []
    for i in range(n - 1):
        dif.append(x[i + 1] - x[i])
    difs = []
    for i in range(n):
        difs.append(abs(s - x[i]))
    res = min(min(dif), min(difs))
    for i in range(res):
        flag = True
        for j in range(n - 1):
            if dif[j] % (res - i) != 0:
                flag = False
                break
        if flag:
            res -= i
            break
    print(res)
else:
    print((abs(x[0] - s)))

N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
dist = [abs(x[0] - X)]
for i in range(N - 1):
    dist.append(x[i + 1] - x[i])
# dist内の最大公約数を求めればよい
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


res = dist[0]
for i in range(1, N):
    res = gcd(res, dist[i])
print(res)

-n, s = (int(i) for i in input().split()) -x = list(int(i) for i in input().split()) -x = sorted(x) -if n > 1: -    dif = [] -    for i in range(n - 1): -        dif.append(x[i + 1] - x[i]) -    difs = [] -    for i in range(n): -        difs.append(abs(s - x[i])) -    res = min(min(dif), min(difs)) -    for i in range(res): -        flag = True -        for j in range(n - 1): -            if dif[j] % (res - i) != 0: -                flag = False -                break -        if flag: -            res -= i -            break -    print(res) -else: -    print((abs(x[0] - s))) +N, X = list(map(int, input().split())) +x = list(map(int, input().split())) +x.sort() +dist = [abs(x[0] - X)] +for i in range(N - 1): +    dist.append(x[i + 1] - x[i]) +# dist内の最大公約数を求めればよい +def gcd(a, b): +    if b == 0: +        return a +    else: +        return gcd(b, a % b) + + +res = dist[0] +for i in range(1, N): +    res = gcd(res, dist[i]) +print(res)