There are N cities on a number line. The i-th city is located at coordinate x_i.
Your objective is to visit all these cities at least once.
In order to do so, you will first set a positive integer D.
Then, you will depart from coordinate X and perform Move 1 and Move 2 below, as many times as you like:
 - Move 1: travel from coordinate y to coordinate y + D.
 - Move 2: travel from coordinate y to coordinate y - D.
Find the maximum value of D that enables you to visit all the cities.
Here, to visit a city is to travel to the coordinate where that city is located.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 10^5
 - 1 \leq X \leq 10^9
 - 1 \leq x_i \leq 10^9
 - x_i are all different.
 - x_1, x_2, ..., x_N \neq X

-----Input-----
Input is given from Standard Input in the following format:
N X
x_1 x_2 ... x_N

-----Output-----
Print the maximum value of D that enables you to visit all the cities.

-----Sample Input-----
3 3
1 7 11

-----Sample Output-----
2

Setting D = 2 enables you to visit all the cities as follows, and this is the maximum value of such D.
 - Perform Move 2 to travel to coordinate 1.
 - Perform Move 1 to travel to coordinate 3.
 - Perform Move 1 to travel to coordinate 5.
 - Perform Move 1 to travel to coordinate 7.
 - Perform Move 1 to travel to coordinate 9.
 - Perform Move 1 to travel to coordinate 11.

Difficulty: introductory

Starter code:

Solutions:
from fractions import gcd
from functools import reduce

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

print((reduce(gcd, [abs(i-x) for i in c])))


import math
from functools import reduce
from sys import setrecursionlimit
setrecursionlimit(10**6)

def gcd(*numbers):
  return reduce(math.gcd, numbers)

n,x = map(int,input().split())
xl = list(map(int,input().split()))
xl = list(map(lambda y: abs(y-x), xl))

ans = -1
if len(xl) == 1:
    ans = xl[0]
else:
    ans = gcd(*xl)

print(ans)

import math
from functools import reduce
def gcd(numbers):
    return reduce(math.gcd, numbers)
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b.append(a[1])
c = sorted(b)
d = []
for i in range(a[0]):
  d.append(c[i+1]-c[i])
print(gcd(d))

def gcd(a,b):
    while a!=0 and b!=0:
        if a>b: #a<=b
            c = a
            a = b
            b = c
        b %= a
    return max(a,b)

n,x = map(int,input().split())
d = sorted(list(map(lambda a:abs(a-x),list(map(int,input().split())))))
now = d[0]
for i in d[1:]:
    now = gcd(now,i)
print(now)

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque

def gcd(a, b):
    """最大公約数"""
    a, b = (a, b) if a >= b else (b, a)
    if b == 0:
        return a
    return gcd(b, a % b)


# from decorator import stop_watch
#
#
# @stop_watch
def solve(N, X, x):
    x_abs = [abs(X - xi) for xi in x]
    ans = x_abs[0]
    for xi in x_abs[1:]:
        ans = gcd(ans, xi)
    print(ans)


def __starting_point():
    N, X = list(map(int, input().split()))
    x = [int(i) for i in input().split()]
    solve(N, X, x)

    # # test
    # from random import randint
    # from func import random_str
    # N, X = 10 ** 5, randint(1, 10 ** 9)
    # x = [randint(1, 10 ** 9) for _ in range(N)]
    # solve(N, X, x)

__starting_point()

n,x=map(int, input().split())
xlist=list(map(int, input().split()))
ylist=[]
for i in range(n):
  ylist.append(xlist[i]-x)
import math
ans=ylist[0]
for i in range(n):
  ans=math.gcd(ans,ylist[i])
print(ans)

N,X = map(int,input().split())
x = list(map(int,input().split()))
ans = 0
from math import gcd
for i in range(N):
  ans = gcd(ans,abs(X-x[i]))
print(ans)

import math
N, X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
x.append(X)
x.sort()

xdst = [x[i+1] - x[i] for i in range(N)]
#print(xdst)

ans = 10**10
if len(xdst) == 1:
    print(xdst[0])
    return

for i in range(N-1):
    ans = min(math.gcd(xdst[i], xdst[i+1]),ans)
print(ans)

import math
from functools import reduce

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

a.append(x)
b=[]
for i in range(len(a)-1):
    b.append(abs(a[i]-a[i-1]))

def gcd(*numbers):
    return reduce(math.gcd, numbers)

print(gcd(*b))

import math
N,X = map(int,input().split())
lsx = list(map(int,input().split()))
lsx.sort()
gcd = abs(lsx[0]-X)
for i in range(1,N):
    gcd = math.gcd(gcd,lsx[i]-lsx[i-1])
print(gcd)

n,x=map(int,input().split())
xlist= list(map(int,input().split()))
if n == 1:
  print(abs(xlist[0]-x))
  return
ylist = []
for i in range(n):
  ylist.append(abs(xlist[i]-x))
from functools import reduce
from math import gcd
print(reduce(gcd,ylist))

import math
N,X = map(int,input().split())
x = list(map(int,input().split()))
y = [abs(x[i]-X) for i in range(N)]
if N == 1:
    print(y[0])
    return
ans = math.gcd(y[0],y[1])
for i in range(2,N):
    ans = min(ans,math.gcd(y[i],ans))
print(ans)

import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return list(map(int, input().split()))
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]

import string

def main():
    N,X = i_map()
    x = i_list()
    l = []
    for i in x:
        l.append(abs(X-i))
    ans = l[0]
    for k in l[1:]:
        ans = gcd(ans,k)
    print(ans)



def __starting_point():
    main()

__starting_point()

import math

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

absx = [abs(X - xx) for xx in x]
absx.sort()

divx0 = []

for i in range(math.ceil(math.sqrt(absx[0])), 0, -1):
    if absx[0] % i == 0:
        divx0.append(i)

t = []
for x in divx0:
    t.append(x)
    t.append(absx[0] // x)

divx0 = t
divx0.sort(reverse=True)

for dx0 in divx0:
    isok = True
    for xx in absx:
        if xx % dx0 != 0:
            isok = False
            break

    if isok:
        print(dx0)
        return

from math import gcd

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

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

dis = []

for i in range(N):
   dis.append(abs(X-x[i]))

res = 0

for i in range(N):
   res = gcd(res, dis[i])

print(res)

import math
N,X=map(int,input().split())
x=list(map(int,input().split()))
x.append(X)
x.sort()
diff=[x[i+1]-x[i] for i in range(N)]

ans=diff[0]

for i in range(1,N):
    ans=math.gcd(ans,diff[i])

print(ans)

import math

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

ans = []
for xx in X:
    ans.append(abs(x-xx))
    
a = ans[0]
for aa in ans:
    a = math.gcd(aa, a)
    
print(a)

import math
N ,X = map(int,input().split())
x = list(map(int,input().split()))
ans = abs(x[0]-X)
for i in range(0, N):
    ans = math.gcd(ans, abs(x[i]-X))

print(ans)

def gcd(a, b):
    """最大公約数"""
    if b == 0: return a
    return gcd(b, a % b)
  

def mapt(fn, *args):
    return list(map(fn, *args))
 
 
def Input():
    return mapt(int, input().split(" "))
 
def main():
    N, X = Input()
    x = Input()
 
    if N == 1:
        print(abs(x[0] - X))
        return
 
    x.append(X)
    x.sort()
    data = [abs(x[i] - x[i+1]) for i in range(N)]
 
    ans = data[0]
    for i in range(1, N):
        ans = gcd(data[i], ans)
    print(ans)
 
 
 
main()

import math, sys
N, X = map(int,input().split())
x = list(map(int, input().split()))
Distance = [abs(X-x[i]) for i in range(N)]

if N ==1:
    print(abs(X-x[0]))
    return

ans = 0
for i in range(N):
    ans = math.gcd(ans, Distance[i])

print(ans)

import sys
import math

input = sys.stdin.readline

def main():
    N, X = map(int, input().split())
    x = list(map(int, input().split()))
    x.append(X)
    ans = abs(x[0]-X)
    for i in range(N):
        ans = math.gcd(ans, abs(x[i]-x[i+1]))
    print(ans)

def __starting_point():
    main()
__starting_point()

import math
n,x=map(int, input().split())
a=[int(x) for x in input().split()]

ans=abs(x-a[0])
for i in range(1,n):
    ans=math.gcd(abs(x-a[i]),ans)

print(ans)

import fractions
def gcdlist(a):
    ans = a[0]
    for i in range(1, len(a)):
        ans = fractions.gcd(ans, a[i])
    return ans

n,y=list(map(int,input().split()))
x=list(map(int,input().split()))
x.append(y)
if y==1:
    print((abs(x[0]-1)))
    return

l=[]
for i in range(n):
    l.append(abs(x[i+1]-x[i]))
print((gcdlist(l))) 




import math
n,a=map(int,input().split())
x=list(map(int,input().split()))+[a]
x.sort()
if n==1:
  print(abs(x[0]-x[1]))
  return
res=x[1]-x[0]
for i in range(1,n):
  res=math.gcd(res,x[i+1]-x[i])
print(res)

#xi-xが全部Dの倍数になればいい
n,x=list(map(int, input().split()))
pos = list(map(int, input().split()))
diff_pos = [abs(s-x) for s in pos]
min_diff = min(diff_pos)
#print(min_diff)
ans = 0
def main():
    for i in range(min_diff,0,-1):
        for n in diff_pos:
            if n % i != 0:
                break
            if n == diff_pos[-1]:
                return i
    
    
print(main())

from functools import reduce
from fractions import gcd

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

# resの最大公約数を求める。　コードは reduce(gcd, list)
print((reduce(gcd, res)))





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

xi.sort()
diff = []
for i in range(n):
    diff.append(abs(xi[i]-x))

import numpy
print((numpy.gcd.reduce(diff)))


#! /usr/bin/env python3

# from fractions import gcd
from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

from functools import reduce

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

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

if N != 1:
    ret = []
    x.append(X)
    now = x[0]

    for i in x[1:]:
        ret += [i - now]
        now = i

    ret = sorted(ret)

    print(gcd_list(ret))

else:
    print(abs(x[0] - X))

import functools
import math

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

x_list.append(X)
num_list = sorted(x_list)
 
tmp = [abs(x[0] - x[1]) for x in zip(num_list[:-1],num_list[1:])]

D = functools.reduce(lambda acc, x: math.gcd(acc, x), tmp, 0)

print(D)


import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def main():
    n, X = list(map(int, input().split()))
    x = list(map(int, input().split()))
    x.append(X)
    x.sort()
    x_dist = [x[i+1] - x[i] for i in range(len(x)-1)]
    print((gcd(*x_dist)))


def __starting_point():
    main()

__starting_point()

import math


def main():
    n, x = map(int, input().split())
    x_lst = list(map(int, input().split()))
    x_lst.sort()

    if n == 1:
        minimum = abs(x_lst[0] - x)
    elif n == 2:
        minimum = abs(x_lst[1] - x_lst[0])
        lst = [abs(x_lst[1] - x), abs(x_lst[0] - x)]
        lst.sort()
        lst.reverse()
        for i in range(2):
            if minimum % lst[i] == 0:
                minimum = lst[i]
                break
    else:
        lst1 = []
        for i in range(n):
            if i != n - 1:
                lst1.append(abs(x_lst[i + 1] - x_lst[i]))

        minimum = math.gcd(lst1[0], lst1[1])
        for i in range(n - 1):
            if i != n - 2:
                minimum = min(minimum, math.gcd(lst1[i], lst1[i + 1]))

        lst2 = []
        for i in range(n):
            lst2.append(abs(x_lst[i] - x))

        lst2.sort()
        lst2.reverse()
        for i in range(n):
            if minimum % lst2[i] == 0:
                minimum = lst2[i]
                break

    print(minimum)


def __starting_point():
    main()
__starting_point()

import math
from functools import reduce

def gcd(*numbers):
	return reduce(math.gcd, numbers)

def gcd_list(numbers):
	return reduce(math.gcd, numbers)

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

if n == 1:
	print(abs(x[0]))
else:
	print(gcd_list(x))

from math import gcd
n,x = 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)

N,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x.sort
d = 0
from math import gcd
for i in range(N):
    d = gcd(d,abs(x[i]-x[i+1]))
print(d)

import math

N, X = map(int, input().split())
cities = list(map(lambda x: int(x) - X, input().split()))

res = abs(cities[0])

for i in range(1, N):
    res = math.gcd(res, cities[i])

print(res)

'''
Created on 2020/08/28

@author: harurun
'''
def main():
  import math
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,X=map(int,pin().split())
  x=list(map(int,pin().split()))
  m=abs(x[0]-X)
  for i in range(1,N):
    m=math.gcd(abs(x[i]-X),m)
  print(m)
  return
main()

import math
N,X = map(int,input().split())
x = list(map(int,input().split()))
ls = []
for i in range(N):
    ls.append(abs(x[i]-X))
now = ls[0]
for i in range(1,N):
    now = math.gcd(ls[i],now)
print(now)

import math

def gcd_list(nums):
  gcd = nums[0]
  for i in range(1,len(nums)):
    gcd = math.gcd(gcd,nums[i])
  return gcd

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

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

print(gcd_list(x))

from math import *

N,X=list(map(int,input().split()))
x=list(map(int,input().split()))
ans=0
for i in x:
  ans=gcd(ans,abs(i-X))
print(ans)


from functools import reduce
import math

n,x=map(int,input().split())
a=sorted(map(int,input().split()))
a=[i-x for i in a]

if len(a)==1:print(abs(a[0]));return
if len(a)==2:print(math.gcd(a[0],a[1]));return

l=[]
for y in range(n-1):
    l.append(a[y+1]-a[y])
    
print(reduce(lambda x,y:math.gcd(x,y),l))

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

temp = abs(x- al[0])

for i in range(1,n):
    y = al[i]-al[i-1]
    temp = math.gcd(temp,y)
 
print(temp)

import math

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

dist = []
for i in range(N):
  dist.append(abs(xs[i] - X))

ans = dist[0]

for d in dist[1:]:
  ans = math.gcd(ans, d)

print(ans)

# -*- coding: utf-8 -*-
"""
Created on Tue Sep 15 01:58:46 2020

@author: liang
"""

from math import gcd

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

ans = A[0]
for i in range(N):
    ans = gcd(ans,A[i])
print(ans)

n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a = sorted(a)
diff_list = [0] * n
for i in range(1, n + 1):
    diff_list[i - 1] = a[i] - a[i - 1]
g = diff_list[0]
import math
for i in range(1, n):
    g = math.gcd(g, diff_list[i])
print(g)

from math import gcd
def readinput():
    n,x=list(map(int,input().split()))
    xx=list(map(int,input().split()))
    return n,x,xx

def main(n,x,xx):
    y=[0]*len(xx)
    for i in range(len(xx)):
        y[i] = abs(xx[i] - x)
    if len(y)==1:
        ans=y[0]
    else:
        ans=gcd(y[0],y[1])
        for i in range(2,n):
            ans=gcd(ans,y[i])
    return ans

def __starting_point():
    n,x,xx=readinput()
    ans=main(n,x,xx)
    print(ans)

__starting_point()

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

n, x = map(int, input().split())
xxx = list(map(lambda xn: abs(int(xn) - x), input().split()))
ans = xxx[0]
for i in range(1, n):
    ans = gcd(ans, xxx[i])
print(ans)

N,X=list(map(int,input().split()))
import math
a=list(map(int,input().split()))
a.append(X)
a.sort()
S=[]
for i in range(N):
    S.append(a[i+1]-a[i])

    
ans=S[0]
for j in range(1,N):
    ans=math.gcd(ans,S[j])
    
print(ans)


import math
from functools import reduce

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

print(reduce(math.gcd,[X[i+1]-X[i] for i in range(n)]))

from math import gcd

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

aX = list([abs(x-X) for x in xs])

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


from functools import reduce
from math import gcd
n, x = map(int, input().split())
l = [abs(x - int(i)) for i in input().split()]
print(reduce(gcd, l))

import math
n,x = map(int, input().split()) 
num_list = list(map(int, input().split())) 
res = 0
for i in num_list:
    res = math.gcd(res, abs(i-x))

print(res)

import functools
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)

def gcd(nums):
    if len(nums)==1:
        return nums[0]
    return functools.reduce(euclid, nums)



n,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
a.append(k)
a.sort()

sa=[]

for i in range(1,n+1):
    sa.append(a[i]-a[i-1])



print((gcd(sa)))



n, x = map(int,input().split())
li = list(input().split())
li = [abs(int(a)-x) for a in li]

def gcd(a,b):
    while a%b!=0:
        a,b = b,a%b
    return b
    
from functools import reduce

a = reduce(gcd,li)
print(a)

from math import gcd
N,X=map(int,input().split())
x=list(map(int,input().split()))

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

else:
  l=[]
  for i in range(N):
    l_=abs(X-x[i])
    l.append(l_)
  #print(l)
  ans=l[0]
  for i in range(1,len(l)):
    ans=gcd(ans,l[i])

  print(ans)

import math
n,m=map(int,input().split())
x=[int(x) for x in input().split()]

mi=min(x)

l=[abs(x[i]-x[i+1]) for i in range(n-1)]
ans=abs(mi-m)
for i in l:
  ans=math.gcd(ans,i)
print(ans)

import functools
import math

N, X = [int(i) for i in input().split()]
x_list = [abs(int(i) - X) for i in input().split()]

D = functools.reduce(lambda acc, x: math.gcd(acc, x), x_list, 0)

print(D)

N,X=map(int,input().split())
*C,=map(int,input().split())

t=[abs(c-X) for c in C]

import math
from functools import reduce
print(reduce(math.gcd, t))

#36 C - Skip
import bisect
import math
N,X = map(int,input().split())
x = list(map(int,input().split()))
x = sorted(x,reverse = False)

bisect.insort_left(x,X)
# 間隔の最小の素数
d_lis = []
for i in range(len(x)-1):
    d = x[i+1] - x[i]
    d_lis.append(d)
d_lis = sorted(d_lis,reverse = False)

ans = d_lis[0]
for j in range(1,len(d_lis)):
    ans = math.gcd(ans,d_lis[j])
print(ans)

import math
from functools import reduce
 
def gcd(*numbers):
	return reduce(math.gcd, numbers)

def gcd_list(numbers):
	return reduce(math.gcd, numbers)

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

n,x=map(int,input().split())
L=list(map(int,input().split()))
L.append(x)
L.sort()
D=[]
for i in range(n):
	d=L[i+1]-L[i]
	D.append(d)

import math
ans = D[0]
for i in range(1, n):
    ans = math.gcd(ans, D[i])

print(ans)

import sys
import math
from functools import reduce

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

l=[]

for i in x:
        b=abs(i-k)
        l.append(b)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

ans=(gcd_list(l))

print(ans)

#再帰
def gcd(a, b):
	if b==0:
		return a
	return gcd(b, a%b)
#ループ
def gcd(a,b):
  while b:
    a,b = b,a%b
  return abs(a)

def solve(x_list):
	ans=0
	for x in x_list:
		ans=gcd(ans, x)
	return ans

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

print(solve(x_list))

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

y = x[0]
for  i in range(1,N):
    z = x[i]
    y,z = max(y,z),min(y,z)
    while z!=0:
        y,z = z,y%z
print(y) 

from functools import reduce
from fractions import gcd

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

cnt  = []
for i in range(N):
    cnt.append(abs(X - A[i]))

print((reduce(gcd, cnt)))




def l():
    return list(map(int, input().split()))

N, X = l()
x = l()
for i in range(N):
    x[i] = abs(x[i] - X)

# print(x)

mini = min(x)
lst = []
for i in range(1, int(mini**0.5)+1):
    if mini % i == 0:
        lst.append(i)
        lst.append(mini // i)

lst.sort()
lst = lst[::-1]
# print(lst)
for i in lst:
    flag = True
    for j in x:
        if j % i != 0:
            flag = False
    if flag:
        break
print(i)

import math
from functools import reduce

def gcd(list):
  return reduce(math.gcd, list)

n, x = map(int, input().split())
a = map(lambda b: abs(int(b) - x), input().split())
print(gcd(a))

import math
N,X = map(int,input().split())
xl = [abs(x-X)for x in map(int,input().split())]
ans = xl[0]

for x in xl[1:]:
    ans = math.gcd(ans,x)
print(ans)

n,x=map(int,input().split())
X=list(map(int,input().split()))
for i in range(n):
  X[i]=abs(X[i]-x)
from math import gcd
ans=X[0]
for i in range(1,n):
  ans=gcd(ans,X[i])

print(ans)

import fractions

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

l.append(x)
sl=sorted(l)

lis=[sl[i+1]-sl[i] for i in range(n)]

ans=0
for i in range(0, n):
    ans = fractions.gcd(ans, lis[i])
    
print(ans)



import sys
import math

input = sys.stdin.readline
N, X = map(int, input().split())
A = list(map(int, input().split()))

gcd = abs(X - A[0])
for a_i in A:
    gcd = math.gcd(gcd, abs(X-a_i))

print(gcd)

import numpy as np
n,X = map(int,input().split())
x = list(map(int,input().split()))
x.append(X)
x = sorted(x)
dis = []
for i in range(n):
  dis.append(x[i+1]-x[i])
print(np.gcd.reduce(dis))

N, X = map(int, input().split())
x = list(map(int, input().split()))
import math
for i in range(N):
	x[i] -= X
ans = x[0]
for i in range(1, N):
	ans = math.gcd(ans, x[i])
print(abs(ans))

import math
from functools import reduce

def gcd_list(numbers):
  return reduce(math.gcd, numbers)

N,X = map(int,input().split())
x_list = [X] + list(map(int,input().split()))
x_list.sort()

dist = [0] * (N + 1)
for i in range(N):
  dist[i] += x_list[i+1] - x_list[i]
  
ans = gcd_list(dist)
print(ans)

import math
import functools

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

print((functools.reduce(math.gcd, A)))


def resolve():
    from math import gcd
    _, X = [int(i) for i in input().split()]
    xx = [int(i) for i in input().split()]
    ans = abs(X - xx[0])
    for x in xx:
        ans = gcd(ans, abs(X - x))
    print(ans)


def __starting_point():
    resolve()

__starting_point()

import math

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

xi = list(map(lambda z: abs(z - x), xi))
g = xi[0]
for i in range(1, n):
    g = math.gcd(g, xi[i])
print(g)

import sys,math
n,x=map(int,sys.stdin.readline().split())
xl=[*map(int,sys.stdin.readline().split())]
yl=[abs(x-i) for i in xl]


d=yl[0]
for i in range(n):
    d=math.gcd(d,yl[i])

print(d)

import sys
import math

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    n, start = inl()
    X = inl()
    g = None
    for x in X:
        d = abs(x - start)
        if g is None:
            g = d
        else:
            g = math.gcd(g, d)
    return g


print(solve())


import math
n,x = map(int,input().split())
xl = list(map(int,input().split()))
dis = []
ans = 0
for i in range(n):
  dis.append(abs(x-xl[i]))
for i in range(n):
  ans = math.gcd(ans,dis[i])
print(ans)

from math import gcd
n, x = list(map(int, input().split()))
ls = sorted(list(map(int, input().split())))
if x == 1:
    print((abs(x-ls[0])))
    return
distant = []
for i in range(n):
    diff = abs(ls[i]-x)
    distant.append(diff)
distant.sort()
a = distant[0]
for i in distant:
    g = gcd(a, i)
    a = g
print(g) 


import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    n, x = read_ints()
    d = read_int_list()
    ans = abs(x - d[0])
    
    for i in range(1, n):
        ans = GCD(ans, abs(x - d[i]))
    print(ans)    

def __starting_point():
    Main()
__starting_point()

N,X = map(int,input().split())
List = list(map(int,input().split()))
abs_List = [abs(List[i] - X) for i in range(N)]

import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd(*abs_List))

from math import gcd
n, x0 = list(map(int, input().split()))
x = [abs(_x-x0) for _x in list(map(int, input().split()))]
x.sort()

ans = x[0]
for i in range(n):
    ans = gcd(ans, x[i])
print(ans)


from math import gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))

xx = list()
for i in range(N):
    xx.append(abs(X-x[i]))
num = xx[0]
for i in range(1,N):
    num = gcd(num,xx[i])
print(num)

import math

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

res = 0
for i in xl:
    res = math.gcd(res, abs(i-x))

print(res)

from math import gcd

n, X = map(int, input().split())
xlst = list(map(int, input().split()))
ans = X - xlst[0]
for x in xlst:
    ans = gcd(ans, X - x)
print(ans)

import math
N,X= map(int,input().split())
x=list(map(int, input().split()))
x.append(X)
x.sort()
d=[]
if N==1:
  print(x[1]-x[0])
  return
for i in range(N):
  d.append(x[i+1]-x[i])
gc=math.gcd(d[0],d[1])
for i in range(N):
  gc=math.gcd(d[i],gc)
print(gc)

import math

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

arr = [0]*N
for i in range(N):
    arr[i] = abs(x[i]-X)
ans = arr[0]
for i in range(1,N):
    ans = math.gcd(ans, arr[i])
    
print(ans)

from math import gcd
n, x = 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)

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

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

res = a[0]
for i in range(n):
  res = gcd(res,a[i])
print(res)

import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.append(x)
a.sort()
d = set()
for i in range(n):
  d.add(a[i + 1] - a[i])
d = list(d)
ans = gcd_list(d)
print(ans)

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

x.append(X)
from math import gcd
g = x[1] - x[0]
for i in range(N):
    g = gcd(g, (x[i+1] - x[i]))

print(abs(g))

import math

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


import math
from functools import reduce

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

print(ans)


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N, X = MI()
    L = LI()
    L = [abs(i-X) for i in L]
    ans = L[0]
    for i in L:
        ans = math.gcd(ans, i)
    print(ans)
    
    
def __starting_point():
    main()
__starting_point()

from math import gcd

n, x = map(int, input().split())
a = [int(i) - x for i in list(map(int, input().split()))]

now = a[0]
for i in a:
    now = gcd(now, i)

print(now)

import  math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

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


import math
from functools import reduce

def gcd(*numbers):
  return reduce(math.gcd, numbers)

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

a = [abs(x - i) for i in xx]

print(gcd(*a))

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
    
a = [int(s) for s in input().split()]
N = a[0]
st = a[1]
mini = int(-1)
b = [int(s) for s in input().split()]

for i in range(N):
    if abs(b[i] - st) < mini or mini == -1:
        mini = abs(b[i] - st)

yakulist = make_divisors(mini)
gyakulist = sorted(yakulist, reverse=True)
kazu = len(gyakulist)
flag = int(0)

for i in range(kazu):
    for j in range(N):
        if abs(b[j] - st) % gyakulist[i] != 0:
            flag = 1
        else:
            pass
    if flag == 0:
        print(gyakulist[i])
        break
    else:
        flag = 0

#https://note.nkmk.me/python-gcd-lcm/
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n,x = map(int,input().split())
a = list(map(int,input().split()))
tmp = []
for i in range(n):
    tmp.append(abs(a[i]-x))
    
print(gcd_list(tmp))