CodeEff/ECCO huggingface dataset:
# Original solution
N,X=list(map(int,input().split()))
inputcities=list(map(int, input().split()))
cities=list(set([abs(inputcities[i]-X) for i in range(N)]))
N=len(cities)
count=0
flag=0
minimum=min(cities)
for j in range(minimum+1)[::-1]:
  for i in range(N):
    if cities[i]%j==0:
      count+=1
    else:
      count=0
      break
    if count==N:
      print(j)
      flag=1
      break
  if flag==1:
    break

# Optimized solution
def gcd(a,b):
    if a < b:
        a,b = b,a
    if a % b == 0:
        return b
    else:
        return gcd(b,(a % b))
 
N,X=list(map(int,input().split()))
inputcities=list(map(int, input().split()))
cities=[abs(inputcities[i]-X) for i in range(N)]
cities.sort()
D=cities[0]
for i in range(N):
  D=gcd(D,cities[i])
print(D)
# Original solution
N,X = list(map(int, input().split()))
l = sorted(map(int, input().split()+[X]))
r = [l[n+1] - l[n] for n in range(N)]
ans = r.pop()
for i in r:
    while ans%i != 0:
        ans,i = i,ans%i
    ans = i
print(ans)

# Optimized solution
N,X = list(map(int, input().split()))
r = [abs(X-i) for i in map(int, input().split())]
ans = r.pop()
for i in r:
    while ans%i != 0:
        ans,i = i,ans%i
    ans = i
print(ans)
# Original solution
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
L.append(X)
L.sort()
cand = []
def gcd(x, y):
    if x > y:
        small = y
    else:
        small = x
    for i in range(1, small + 1):
        if ((x % i == 0) and (y % i == 0)):
            gcd = i
    return gcd

for i in range(N):
    cand.append(abs(L[i] - L[i+1]))

for i, can in enumerate(cand):
    if i == 0:
        tmp = can
        continue
    tmp = gcd(tmp, can)
print(tmp)


# Optimized solution
N, X = list(map(int, input().split()))
L = list(map(int, input().split()))
L.append(X)
L.sort()
cand = []
def gcd(x, y):
    while y != 0:
        (x, y) = (y, x % y)
    return x

for i in range(N):
    cand.append(abs(L[i] - L[i+1]))

for i, can in enumerate(cand):
    if i == 0:
        tmp = can
        continue
    tmp = gcd(tmp, can)
print(tmp)
# Original solution
N,X = list(map(int,input().split()))
x = [int(i) for i in input().split()]
x = [i-X for i in x]
Min = min([abs(i) for i in x])
flag = False
for i in range(1,Min+1):
    if flag == True:
        break
    flag = True
    if Min%i==0:
        ans = Min//i
        for j in x:
            if j%ans!=0:
                flag = False
    else:
        flag = False
print(ans)

# Optimized solution
N,X = list(map(int,input().split()))
x = [int(i) for i in input().split()]
def main():
      global X
      global x
      print((answer(pre(X,x))))
def pre(a,b):
      b = [i-a for i in b]
      return b
def answer(k):
      Min = min([abs(i) for i in k])
      flag = False
      for i in range(1,Min+1):
            if flag == True:
                  break
            flag = True
            if Min%i==0:
                  ans = Min//i
                  for j in k:
                        if j%ans!=0:
                              flag = False
            else:
                  flag = False
      return ans
main()
# Original solution
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x%y)


a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
c.append(b)
c.sort()
d = 0
for i in range(1, a + 1):
    d = g_c_d(c[i] - c[i-1], d)
print(d)


# Optimized solution
def g_c_d(x, y):
    if x == 0:
        return y
    elif y == 0:
        return x
    else:
        return g_c_d(y, x % y)


a, b = list(map(int, input().split()))
c = list(map(int, input().split()))
c.append(b)
d = 0
for i in range(len(c)):
    d = g_c_d(d, abs((c[i] - c[i-1])))
print(d)
# Original solution
N, X = list(map(int, input().split()))
lst = list(map(int, input().split()))
ans = []
for i in lst:
    ans.append(abs(i-X))
small = min(ans)
for i in ans:
    if i%small == 0:
        continue
    else:
        while i != small:
            i = i%small
            small = small - i
print(small)

# Optimized solution
N, X = list(map(int, input().split()))
lst = list(map(int, input().split()))
ans = []
for i in lst:
    ans.append(abs(i-X))
small = min(ans)
for i in ans:
    if i%small != 0:
        while i%small != 0:
            i = i%small
            small = small - i
print(small)
# Original solution
def nl(): return list(map(int, input().split()))
def gcd(x, y):
    if x < y:
        # x >= y とする
        x, y = y, x
    while True:
        r = x % y
        if r == 0:
            break
        else:
            x, y = y, r
    return y

N, X = nl()
x = nl()
x2 = list(map(abs, ([v - X for v in x])))

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

# Optimized solution
def gcd(x, y):
    if x < y:# x >= y とする
        x, y = y, x
    r = x % y
    res = y if r == 0 else gcd(y, r) 
    return res

N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x2 = [abs(i - X) for i in x]

g = x2[0]
for i in x2:
    g = gcd(g, i)
print(g)
# Original solution
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x = sorted(x)
x = list([abs(arg - X) for arg in x])

g = x[0]
for xx in x:
    g = gcd(g, xx)
print(g)


# Optimized solution
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)


N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x = list([abs(arg - X) for arg in x])

g = x[0]
for xx in x[1:]:
    g = gcd(g, xx)
print(g)
# Original solution
#coding: utf-8
from functools import reduce
def gcd(a, b):
    if b == 0:
        return a

    else:
        return gcd(b, a%b)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x = [abs(X - x[i]) for i in range(N)]
l = [x[0]]
for i in range(len(x)):
    for j in range(i+1, len(x)):
        l.append(gcd(max(x[i], x[j]), min(x[i], x[j])))
print((min(l)))

# Optimized solution
#coding: utf-8
from functools import reduce
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x = [abs(X - x[i]) for i in range(N)]
it = iter(x)
value = x[0]
for i in it:
    value = gcd(value, i)
print(value)
# Original solution
from math import gcd
n, x = list(map(int, input().split()))
m = [x]+list(map(int, input().split()))


m.sort()

if n==1:
  print((m[1]-m[0]))
else:
  res = gcd(m[1]-m[0], m[2]-m[1])
  for i in range(1, n-1):
    a = m[i+1]-m[i]
    b = m[i+2]-m[i+1]
    if res >= gcd(a,b):
      if res%gcd(a,b)==0:
        res = gcd(a,b)
      else:
        res = gcd(res, gcd(a, b))
    else:
      if gcd(a,b)%res!=0:
        res = gcd(res, gcd(a, b))
  print(res)

# Optimized solution
import math
n,a=list(map(int,input().split()))
x=list(map(int,input().split()))+[a]
x.sort()
if n==1:
  print((abs(x[0]-x[1])))
  exit()
res=x[1]-x[0]
for i in range(1,n):
  res=math.gcd(res,x[i+1]-x[i])
print(res)
# Original solution
def gcd(A, B):
    if A%B == 0:
        return B
    else:
        return gcd(B, A%B)
N, X = list(map(int, input().split()))
x = [abs(int(i) - X) for i in input().split()] 
if N == 1:
    print((x[0]))
    exit()
gcd_x = []
for i in range(N-1):
    gcd_x.append(gcd(x[i], x[i+1]))
print((min(gcd_x)))

# Optimized solution
def gcd(A, B):
    while B != 0:
        A, B = B, A%B
    return A
N, X = list(map(int, input().split()))
x = [abs(int(i) - X) for i in input().split()] 
y = x[0]
for i in range(N):
    if x[i] % y == 0:
        continue
    y = gcd(y, x[i])
print(y)
# Original solution
import sys

def main():
  input = sys.stdin.readline
  N, S = list(map(int, input().split()))
  C = list(map(int, input().split()))
  C = list(set([abs(c - S) for c in C]))
  min_C = min(C)
  ans = 1
  for i in range(min_C, 1, -1):
    if min_C % i != 0:
      continue
    
    if all([c % i == 0 for c in C]):
      ans = i
      break
  print(ans)


if __name__ == '__main__':
  main()

# Optimized solution
import sys

def gcd(a, b):
  a, b = max(a, b), min(a, b)
  if b == 0:
    return a
  else:
    return gcd(b, a % b)


def main():
  input = sys.stdin.readline
  N, S = list(map(int, input().split()))
  C = list(map(int, input().split()))
  C = list(set([abs(c - S) for c in C]))
  
  ans = C[0]
  for i in range(1, len(C)):
    ans = gcd(ans, C[i])

  print(ans)


if __name__ == '__main__':
  main()
# Original solution
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

N, S = list(map(int,input().split()))
x = list(map(int,input().split()))
x.append(S)
x = sorted(x)
t = x[1]-x[0]

for k in range(N):
    t = gcd(t,x[k+1]-x[k])

print(t)

# Optimized solution
N, X = list(map(int,input().split()))
x = list(map(int,input().split()))

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)
ans = abs(X-x[0])

for k in range(1,N):
    ans = gcd(ans,abs(x[k]-x[k-1]))
print(ans)
# Original solution
values = input()
n,x = int(values.split(" ")[0]), int(values.split(" ")[1])
cities = input()
cities = [int(i) for i in cities.split(" ")]

distances = []
for i in cities:
	distances.append(abs(i-x))
m = max(distances)

D = m
while(D<=m):
	pos = x
	flag = True
	for i in range(len(cities)):
		if cities[i]<pos:
			k = (cities[i]-pos)/float(-D)
		else:
			k = (cities[i]-pos)/float(D)
		if k!=int(k):
			flag = False
		pos = cities[i]
		#print("\t",k, pos)

	if flag == True:
		print(D)
		break
	D -= 1

# Optimized solution
values = input()
n,x = int(values.split(" ")[0]), int(values.split(" ")[1])
cities = input()
cities = [int(i) for i in cities.split(" ")]

cities = sorted(cities)

distances = []
for i in cities:
	distances.append(abs(i-x))
for i in range(1,len(cities)):
	distances.append(abs(cities[i]-cities[i-1]))

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

m = distances[0]
for i in range(1,len(distances)):
	m = hcd(m, distances[i])
print(m)
# Original solution
N, X = [int(x) for x in input().split(' ')]

city = [abs(int(x) - X) for x in input().split(' ')]
max_fact = city[0]

for x in city:
    while x!=0:
        if x > max_fact:
            x -= max_fact
        elif x == max_fact:
            break
        else:
            tmp = max_fact
            max_fact = x
            x = tmp
    if max_fact==1:
        break

print(max_fact)

# Optimized solution
N, X = [int(x) for x in input().split(' ')]

city = [abs(int(x) - X) for x in input().split(' ')]
max_fact = city[0]

for x in city:
    while x!=0:
        x %= max_fact
        if x > 0:
            tmp = max_fact
            max_fact = x
            x = tmp
    if max_fact==1:
        break

print(max_fact)
# Original solution
import math

def count_factor(factor, factors):
    count = 0
#    print("factor: " + str(factor))
#    print(factors)

    for f in factors:
        if f == factor:
            count += 1

    return count

def divide_to_prime_factors(num):
    factor = 1
    factors = []

    while factor <= math.sqrt(num):
        if num % factor == 0:
            factors.append(factor)
            if factor * factor != num:
                factors.append(int(num / factor))

        factor += 1

    return factors

n_and_x = input().split(" ")
city_num = int(n_and_x[0])
start = int(n_and_x[1])

city_places = [int(n) for n in input().split(" ")]

city_distances = []
for place in city_places:
    city_distances.append(abs(place - start))

dist_factors = []
for dist in city_distances:
    dist_factors.extend(divide_to_prime_factors(dist))
#print(dist_factors)

step = 1
for factor in dist_factors:
    if factor > step:
        fact_count = count_factor(factor, dist_factors)
#        print(fact_count)
        if fact_count == city_num:
            step = factor

#step = int(max(city_distances) / 2)

#can_travel = False
#while can_travel == False:
#    can_travel = True
#    for city in city_places:
#        if abs(city - start) % step != 0:
#           can_travel = False
#    if can_travel == False:
#        step -= 1

print(step)

# Optimized solution
import math

def is_common(dists, factor):
    count = 0
#    print("factor: " + str(factor))
#    print(factors)
#    print(factor)
#    print(factors[1:]

    for dist in dists:
        if dist % factor != 0:
            return False
    
    return True

def divide_to_prime_factors(num):
    factor = 1
    factors = []

    while factor <= math.sqrt(num):
        if num % factor == 0:
            factors.append(factor)
            if factor * factor != num:
                factors.append(int(num / factor))

        factor += 1

    return factors

n_and_x = input().split(" ")
city_num = int(n_and_x[0])
start = int(n_and_x[1])

city_places = [int(n) for n in input().split(" ")]

city_distances = []
for place in city_places:
    city_distances.append(abs(place - start))

dist_factors = reversed(sorted(divide_to_prime_factors(city_distances[0])))

step = 1
for fact in dist_factors:
    if is_common(city_distances[1:], fact):
        step = fact
        break

#        print(fact_count)
#step = int(max(city_distances) / 2)

#can_travel = False
#while can_travel == False:
#    can_travel = True
#    for city in city_places:
#        if abs(city - start) % step != 0:
#           can_travel = False
#    if can_travel == False:
#        step -= 1

print(step)
# Original solution
n,x = list(map(int,input().split()))

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



xl = [i-x for i in xl]

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


ans = abs(xl[0])
for xx in xl:
    ans = abs(gcd(ans, xx))

print(ans)    

# Optimized solution
n,x = list(map(int,input().split()))
xl = list(map(int,input().split()))

xl = [abs(x-i) for i in xl]

# a,bの最大公約数
def gcd(a, b):
   while b:
       a, b = b, a % b
   return a

ans = xl[0]
for x in xl:
    ans = gcd(ans, x)

print(ans)
# Original solution
import sys

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

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

if N==1:
    print((abs(X-x[0])))
    sys.exit()



x.append(X)
x.sort()

ANS=gcd(x[1]-x[0],x[2]-x[1])

for i in range(N):
    ANS=gcd(ANS,x[i+1]-x[i])

print(ANS)


# Optimized solution
N,X=list(map(int,input().split()))
A=list(map(int,input().split()))

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

s=abs(A[0]-X)
for i in range(1,N):
    s=gcd(s,abs(A[i]-X))

print(s)
# Original solution
n, x = list(map(int, input().split()))
xi = list(map(int, input().split()))

diff = max(max(xi) - x, x - min(xi))

for d in range(diff, 1, -1):
    xd = x%d
    sol = True

    for xval in xi:
        if ((xval % d) - xd)%d != 0:
            sol = False
            break

    if sol:
        print(d)
        break

# Optimized solution
n, x = list(map(int, input().split()))
xi = list(map(int, input().split()))

xi = [abs(xval - x) for xval in xi]

def gcd(a, b):
    if a == 0:
        return b
    elif b == 0:
        return a
    else:
        return gcd(b, a%b)

res = xi[0]
for i in range(1, len(xi)):
    res = gcd(res, xi[i])

print(res)
# Original solution
def gcd(x,y):
    if y>x:
        a=y
        y=x
        x=a
    a=1
    while a*y:
        a=x%y
        x=y
        y=a
    return x

a,b=list(map(int,input().split()))
c=list(map(int,input().split()))
c.append(b)
c.sort()
for i in range(a):
    c[-1-i]-=c[-2-i]
b=0
for i in range(a):
    b=gcd(c[i+1],b)
print(b)

# Optimized solution
def gcd(x,y):
    if y>x:
        a=y
        y=x
        x=a
    while y:
        a=x%y
        x=y
        y=a
    return x

a,b=list(map(int,input().split()))
c=list(map(int,input().split()))
c.append(b)
c.sort()
for i in range(a):
    c[-1-i]-=c[-2-i]
b=0
for i in range(a):
    b=gcd(c[i+1],b)
print(b)
# Original solution
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))

def gcd(x, y):
    while (y != 0):
        x, y = y, x%y

    return x

diff = []

for j in l:
    diff.append(abs(j - x))

ans = diff[0]

for d in diff[1:]:
    ans = gcd(ans, d)

print(ans)





# Optimized solution
n, x = list(map(int, input().split()))
l = list(map(int, input().split()))

def gcd(x, y):
    while (y != 0):
        x, y = y, x%y

    return x

ans = abs(l[0] - x)

for d in l[1:]:
    ans = gcd(ans, abs(d - x))

print(ans)
# Original solution
# encoding: utf-8
N, X = list(map(int, input().split()))
dx = list([x - X for x in list(map(int, input().split()))])

dx_nearest = 10**9
for dxi in dx:
    if (2 *(dxi > 0) - 1) * dxi < dx_nearest: dx_nearest = (2 *(dxi > 0) - 1) * dxi

for D in range(dx_nearest + 1)[::-1]:
    for dxi in dx:
        if dxi % D > 0: break
        else: continue
    else:
        print(D)
        break
else: print("oops")

# Optimized solution
# encoding: utf-8
import math

N, X = list(map(int, input().split()))
x = sorted(list(map(int, input().split())) + [X])

def gcf2(a, b):
    if b == 0: return a
    else: return gcf2(b, (a % b))

# Greatest common factor
# print(x)
GCF = x[1] - x[0]
x_min = x[0]
for i, xi in enumerate(x):
    if i == 0: continue
    GCF = gcf2(GCF, (xi - x_min))

print(GCF)
# Original solution
# encoding: utf-8
import math

N, X = list(map(int, input().split()))
x = sorted(list(map(int, input().split())) + [X])

def gcf2(a, b):
    if b == 0: return a
    else: return gcf2(b, (a % b))

# Greatest common factor
# print(x)
GCF = x[1] - x[0]
x_min = x[0]
for i, xi in enumerate(x):
    if i == 0: continue
    GCF = gcf2(GCF, (xi - x_min))

print(GCF)

# Optimized solution
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))

# targ = []
# # targ.append(abs(X - x[0]))
# for i in range(N - 1):
#     targ.append(abs(x[i + 1] - x[i]))

def mygcd(a, b):
    # print("#", a, b)
    if a < b: return mygcd(b, a)
    elif b == 0: return a
    else: return mygcd(b, a % b)

ans = abs(X - x[0])
for i in range(N - 1):
    ans = mygcd(ans, abs(x[i + 1] - x[i]))

print(ans)
# Original solution
N,X=list(map(int,input().split()))
x=sorted([int(x)-X if int(x)-X>0 else -(int(x)-X) for x in input().split()])
for i in range(x[0]+1)[::-1]:
    if sum([x%i for x in x])==0:
        print(i)
        break

# Optimized solution
N,X=list(map(int,input().split()))
x=sorted([int(x)-X if int(x)-X>0 else -(int(x)-X) for x in input().split()])
for i in range(x[0]+1)[::-1]:
    if x[0]%i:continue
    if sum([x%i for x in x])==0:
        print(i)
        break
# Original solution
from functools import reduce

n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
for i in range(n):
    x[i] -= X
    x[i] = abs(x[i])

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

def gcd_list(n):
    return reduce(gcd, n)

print((gcd_list(x)))

# Optimized solution
from functools import reduce

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

def gcd_list(n):
    return reduce(gcd, n)

n, X = list(map(int, input().split()))
x = list(map(int, input().split()))
dx = [abs(X - i) for i in x]
print((gcd_list(dx)))
# Original solution
def make_divisors(n):
    divisors = []
    n=abs(n)
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return set(divisors)

def main():
  n,m=list(map(int,input().split()))
  x=list(map(int,input().split()))
  s=make_divisors(x[0]-m)
  for i in range(1,n):
    s=s&make_divisors(x[i]-x[i-1])
  print((max(s)))
  
main()

# Optimized solution
def make_divisors(n):
    divisors = []
    n=abs(n)
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return set(divisors)

def main():
  n,m=list(map(int,input().split()))
  x=list(map(int,input().split()))
  s=make_divisors(x[0]-m)
  news=[]
  for i in range(1,n):
    d=x[i]-x[i-1]
    news=[]
    for j in s:
      if d%j==0:
        news.append(j)
    s=set(news)
  print((max(s)))
  
main()
# Original solution

def gcd(p, q):
  a, b = (p, q) if p >= q else (q, p)
  c = a % b
  while c != 0:
    a, b = (b, c) if b >= c else (c, b)
    c = a % b
  return  b

N, X = [int(x) for x in input().split()]
xn = sorted([int(x) for x in input().split()])

diffs = []

if X < xn[0]:
  diffs.append(xn[0] -X)
for n in range(N-1):
  if xn[n] < X < xn[n+1]:
    diffs.append(X - xn[n])
    diffs.append(xn[n+1] - X)
  else:
    diffs.append(xn[n+1] - xn[n])
if X > xn[N-1]:
  diffs.append(X - xn[N-1])
if len(diffs) > 1:
  D = gcd(diffs[0], diffs[1])
  for i in range(N-2):
    D = gcd(D, diffs[i+2])
else:
  D = diffs[0]
print(D)
  

# Optimized solution

def gcd(x, y):
  #assert x >= y
  return gcd(y, x%y) if y else x
 

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

dx =[abs(x-X) for x in Xn]

gcd_num = dx[0]
for x in dx:
  a, b = (gcd_num, x) if gcd_num > x else (x, gcd_num)
  gcd_num = gcd(a, b)
print(gcd_num)
# Original solution
n,x=list(map(int,input().split()))
huga=list(map(int,input().split()))
hoge=[]
for i in range(n):
  hoge.append(abs(huga[i]-x))
hoge.sort(reverse=True)
D=hoge[0]

for i in range(D):
  ans=D-i
  flag=0
  for j in range(n):
    if(hoge[j]%ans>0):
      flag=1
  if(flag==0):
    print(ans)
    break

# Optimized solution
#ユークリッド互除法
def gcd(a,b):
  if(a<b):
    a,b=b,a
  if(b==0):
    return a
  c= a%b
  return gcd(b,c)

n,x=list(map(int,input().split()))
hoge=list(map(int,input().split()))
ans=abs(x-hoge[0])
for i in range(n):
  ans=gcd(ans,abs(hoge[i]-x))
print(ans)
# Original solution
#abc110 C
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
distance = [ abs(x[i]-X) for i in range(N)]


for d in range(min(distance),0,-1):
    flag = 1
    for i in range(N):
        if distance[i] % d != 0:
            flag = 0
    if flag == 1:
        print(d)
        break

# Optimized solution
#abc110 C 最大公約数
N, X = list(map(int, input().split()))
x= list(map(int, input().split()))
distance = [ abs(x[i]-X) for i in range(N)]

def gcd( x , y ):
    while y != 0:
        x,y = y, x%y
    return x

def GCD(lis):
    g = lis[0]
    for i in range(1,len(lis)):
        g = gcd( g , lis[i] )
    return g

maxD = GCD(distance)
print(maxD)
# Original solution
from functools import reduce


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


def gcd_n(numbers):
    return reduce(gcd, numbers)


def main():
    N, X, *x = list(map(int, open(0).read().split()))
    x = [abs(X - int(i)) for i in x]
    print((gcd_n(x)))
    return


main()


# Optimized solution
from functools import reduce


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


def gcd_n(numbers):
    return reduce(gcd, numbers)


def main():
    N, X = list(map(int, input().split()))
    x = [abs(X - int(i)) for i in input().split()]
    print((gcd_n(x)))
    return


main()
# Original solution
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    N, X, *xn = list(map(int, open(0).read().split()))
    ans = None
    for x in xn:
        if ans is not None:
            ans = gcd(ans, abs(X - x))
        else:
            ans = abs(X - xn[0])
    print(ans)
    return


main()


# Optimized solution
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    N, X, *xn = list(map(int, open(0).read().split()))
    ans = None
    for x in xn:
        if ans is not None:
            if abs(X - x) % ans:
                ans = gcd(ans, abs(X - x))
        else:
            ans = abs(X - xn[0])
    print(ans)
    return


main()
# Original solution
# coding: utf-8

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x%y)


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

x = list(map(int, input().split()))
x.append(X)
x = sorted(x)

A = [ abs(x[i+1] - x[i]) for i in range(N)]


for i in range(len(A)):
    if i == 0:
        ans = A[i]
    else:
        ans = gcd(ans, A[i])

print(ans)

# Optimized solution
def gcd(x, y):
    while y != 0:
        x, y = y, x % y
    return x


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

ans = 0
for xx in x:
    ans = gcd(ans, abs(X - xx))

print(ans)