#!/usr/bin/env python3

from bisect import insort_left

from fractions import gcd

def lcm(m,n):

    return (m*n)//gcd(m,n)

n,X=list(map(int,input().split()))

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

x.append(X)

x.sort()

g=x[1]-x[0]

for i in range(n):

    g=gcd(g,x[i+1]-x[i])

print(g)

#!/usr/bin/env python3

import sys, math, itertools, collections, bisect

input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')

inf = float('inf') ;mod = 10**9+7

mans = inf ;ans = 0 ;count = 0 ;pro = 1



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

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

X.append(x)

X.sort()

def gcd(a, b):

    while(b != 0):

        a, b = b, a % b

    return a

    

def lcm(m,n):

    return (m*n)//gcd(m,n)



pro = X[1]-X[0]



for i in range(n):

  pro = gcd(abs(X[i+1]-X[i]),pro)

print(pro)
#!/usr/bin/env python3
from bisect import insort_left
from fractions import gcd


def lcm(m, n):
    return (m * n) // gcd(m, n)


n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
x.sort()
g = x[1] - x[0]
for i in range(n):
    g = gcd(g, x[i + 1] - x[i])
print(g)

#!/usr/bin/env python3
import sys, math, itertools, collections, bisect

input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8")
inf = float("inf")
mod = 10**9 + 7
mans = inf
ans = 0
count = 0
pro = 1
n, x = list(map(int, input().split()))
X = list(map(int, input().split()))
X.append(x)
X.sort()


def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


def lcm(m, n):
    return (m * n) // gcd(m, n)


pro = X[1] - X[0]
for i in range(n):
    pro = gcd(abs(X[i + 1] - X[i]), pro)
print(pro)

-from bisect import insort_left -from fractions import gcd +import sys, math, itertools, collections, bisect + +input = lambda: sys.stdin.buffer.readline().rstrip().decode("utf-8") +inf = float("inf") +mod = 10**9 + 7 +mans = inf +ans = 0 +count = 0 +pro = 1 +n, x = list(map(int, input().split())) +X = list(map(int, input().split())) +X.append(x) +X.sort() + + +def gcd(a, b): +    while b != 0: +        a, b = b, a % b +    return a -n, X = list(map(int, input().split())) -x = list(map(int, input().split())) -x.append(X) -x.sort() -g = x[1] - x[0] +pro = X[1] - X[0] -    g = gcd(g, x[i + 1] - x[i]) -print(g) +    pro = gcd(abs(X[i + 1] - X[i]), pro) +print(pro)