

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)

  


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)











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)

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)

-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 +def gcd(x, y): +    # assert x >= y +    return gcd(y, x % y) if y else x -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) +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)