Problem:
 Score : 300 points    Problem Statement 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 1 3 3
1 7 11      Sample Output 1 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 .        Sample Input 2 3 81
33 105 57      Sample Output 2 24       Sample Input 3 1 1
1000000000      Sample Output 3 999999999

Solution (Python):
import heapq
from fractions import gcd
from functools import reduce

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n, x = nm()
xl = nl()

xl.append(x)

heapq.heapify(xl)


hl = []

last = heapq.heappop(xl)
for i in range(n):
    h = heapq.heappop(xl)
    hl.append(h-last)

print(reduce(gcd,hl))

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

n, start = [int(a) for a in input().split()]
x = [int(b) for b in input().split()]
x = x + [start]
mi = min(x)

g = abs((x[1] - mi) - (x[0] - mi))
for i, v in enumerate(x):
    if (i > 0):
        d = abs((x[i] - mi) - (x[i - 1] - mi))
        g = gcd(g, d)
        
print (g)

Solution (Python):
line = raw_input()
N, X = [int(s) for s in line.split(' ')]
line = raw_input()
xs = [int(s) for s in line.split(' ')]
xs.append(X)

xs.sort()
X = 0
if len(xs) == 1:
    print abs(xs[0])
else:
    sub = [abs(a - b) for a, b in zip(xs[1:], xs)]
    sub.sort()
    ret = sub[0]
    for s in sub[1:]:
        mod = 1
        ss = ret
        while mod > 0:
            mod = s % ss
            s = ss
            ss = mod
        ret = s
    print ret

Solution (Python):
import os, sys, re, math

from fractions import gcd

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

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

g = d[0] if len(d) == 1 else gcd(d[0], d[1])
for i in range(len(d) - 2):
    g = gcd(g, d[i + 2])

print (g)

Solution (Python):
N, X = list(map(int, input().split(' ')))
xs = [abs(X - c) for c in list(map(int, input().split(' ')))]
def gcd(l, s):
    return s if l % s == 0 else gcd(s, l % s)
    
g = xs[0]
for i in xs:  
    g = gcd(i, g)

print(g)

Solution (Python):
import fractions

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


gcd = abs(x[0] - x[1]) 
for i in range(1, N):
    gcd = fractions.gcd(gcd, abs(x[i] - x[i+1])) 

print(gcd)

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

if __name__ == '__main__':
    N, Xini = map(int, input().split())
    X = list(map(int, input().split()))
    for i in range(N):
        X[i] = abs(X[i] - Xini)
    
    before = X[0]
    for i in range(1, N):
        before = gcd(X[i], before)
    
    print(before)

Solution (Python):
import sys
def gcd(a, b):
  if a < b:
    a, b = b, a
  a, b = b, a % b
  if b == 0:
    return a
  else:
    return gcd(a, b)

N, X = map(int, input().split())
x = sorted(list(map(lambda x:int(x) - X, input().split())))
y = []

if N == 1:
  print (abs(x[0]))
  sys.exit()
elif N == 2:
  print (gcd(abs(x[0]), abs(x[1])))
  sys.exit()
for i in range(N-1):
  y.append(x[i+1]-x[i])

ans = y.pop()
while y:
  ans = gcd(ans, y.pop())
print (ans)

Solution (Python):
n,X = map(int, input().split())
x = list(map(int, input().split()))
if n == 1:
    print(abs(X-x[0]))
    exit()

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

x = x + [X]
x.sort()
ans = x[1] - x[0]

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

Solution (Python):
import fractions
N, X=map(int, input().split())
x=list(map(int, input().split()))
if N==1:
  print(abs(X-x[0]))
  exit()

l=[abs(x[i]-X) for i in range(N)]
temp=fractions.gcd(l[0], l[1])
if N==2:
  print(temp)
  exit()
  
for i in range(2, N):
  temp=fractions.gcd(temp, l[i])
  
print(temp)

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

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

    else:
        return gcd(b, a % b)

if n == 1:
    output = abs(X[0] - x)
    print(output)
    exit()

else:
    output = gcd(abs(x - X[0]), abs(X[0] - X[1]))

for i in range(1, n - 1):
    tmp = abs(X[i] - X[i + 1])
    output = gcd(output, tmp)

print(output)

Solution (Python):
from functools import reduce
from fractions import gcd
import sys
input = sys.stdin.readline


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

    B = [abs(A[i]-X) for i in range(N)]
    print(reduce(gcd, B))


if __name__ == '__main__':
    main()

Solution (Python):
import fractions

N, X = [int(elem) for elem in input().split()]
xs = [int(elem) for elem in input().split()]

xs.append(X)
xs = sorted(xs)

diff = []
for x1, x2 in zip(xs[:-1], xs[1:]):
  diff.append(x2 - x1)

if len(diff) > 1:
  res = fractions.gcd(diff[0], diff[1])
  for elem in diff[2:]:
    res = fractions.gcd(res, elem)
  print(res)
else:
  print(diff[0])

Solution (Python):
N, X = list(map(int, input().split()))
a = list(map(int, input().split()))
b = [abs(i - X) for i in a]

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

def gcdlist(l):
    a = l[0]
    for i in range(len(l)):
        a = gcd(a,l[i])
    return a

print(gcdlist(b))

Solution (Python):
def gcd(a,b):
    if b<a:
        a,b = b,a
    while b>0:
        a,b = b,a%b
    return a
N,X = map(int,input().split())
A = list(map(int,input().split()))
if N==1:
    D = abs(X-A[0])
else:
    D = gcd(abs(X-A[0]),abs(X-A[1]))
    for i in range(2,N):
        D = gcd(D,abs(X-A[i]))
print(D)

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

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

x.sort()
dist = []
for i in range(N-1):
    dist.append(x[i+1] - x[i])

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

print(ans)

Solution (Python):
import fractions
from functools import reduce
import numpy as np
N, X = map(int, input().split())
xlist = list(map(int, input().split()))
xlist.append(X)
xlist.sort()
sa = list(np.array(xlist[1:]) - np.array(xlist[:-1]))
print(reduce(fractions.gcd, sa))

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

Solution (Python):
N, X = 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)

Solution (Python):
import numpy as np
import fractions

def q74(N, X, x):
    y = np.array(x)
    z = abs(y - X)
    
    ans = z[0]
    for i in range(1, N):
        ans = fractions.gcd(ans, z[i])
    return ans


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


print(q74(N, X, x))

Solution (Python):
from functools import reduce
from fractions import gcd
n, x = map(int, input().split())
X = [abs(int(num) - x) for num in input().split()]
print(reduce(gcd, X))

Solution (Python):
n,xstart=map(int,input().split())
x=map(int,input().split())
z=[];za=z.append
for i in x:
  za(abs(xstart-i))
import fractions;g=fractions.gcd
a=z[0]
for i in range(n-1):
  a=g(a,z[i+1])
print(a)

Solution (Python):
import numpy as np
from functools import reduce
from fractions import gcd


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

places = np.array(list(map(int, input().split())))

distances = abs(places - X)

answer = reduce(gcd, distances)
print(answer)

Solution (Python):
import fractions
from functools import reduce

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

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

sub = []
for p in point:
    sub.append(abs(p-x))

print(gcd_list(sub))

Solution (Python):
N,X =[int(x) for x in input().split()]
A = [abs(int(x)-X) for x in input().split()]
import fractions
a = A[0]
for i in range(1,N):
  a =fractions.gcd(a,A[i])
print(a)

Solution (Python):


import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7



from fractions import gcd

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

A = [0] * N
for i in range(N):
    A[i] = abs(M-X[i])



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

print(gc)

Solution (Python):
from bisect import bisect
from fractions import gcd


def solve(N, SP):
    _x = list(map(int, input().split()))
    diff = []
    _x.sort()
    sp_pos = bisect(_x, SP)

    x = _x[0:sp_pos] + [SP] + _x[sp_pos:]

    for i in range(N):
        diff.append(x[i+1]-x[i])

    if len(diff) == 1:
        ans = diff[0]
    else:
        ans = diff[1]-diff[0]
        for d in diff[1:]:
            if ans == 1:
                break
            else:
                ans = gcd(ans, d)
    return ans


if __name__ == '__main__':
    n, sp = map(int, input().split())
    print(solve(n, sp))

Solution (Python):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=sys.stdin.readline
def resolve():
    n,x=map(int,input().split())
    A=list(map(lambda y:int(y)-x,input().split()))
    if n==1:
        print(abs(A[0]))
        return
    from fractions import gcd
    from functools import reduce
    print(abs(reduce(gcd,A)))
resolve()

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

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


x_list_new=sorted(x_list)
x_list_new_dif=[abs(x_list_new[i]-X) for i in range(len(x_list_new))]

for i in range(len(x_list_new_dif)):
    if i==0:
        skip=x_list_new_dif[0]
    else:
        skip=gcd(skip,x_list_new_dif[i])
print(skip)

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

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

g = abs(x[0]-s)

for i in range(n):
  g = gcd(g,abs(x[i]-s))

print(g)

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from functools import reduce



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007



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



n, x = LI()
L = [abs(i-x) for i in LI()]
print(reduce(lambda p, q:gcd(p, q), L))

Solution (Python):

from bisect import insort_left
from fractions import gcd
def lcm(m,n):
    return (m*n)//gcd(m,n)
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)

Solution (Python):

from fractions import gcd


def main():
    N, X, *A = map(int, open(0).read().split())
    ans = abs(X - A[0])
    for i in A:
        dif = abs(X - i)
        if dif % ans:
            ans = gcd(ans, dif)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

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


def main():
    N, X, *A = map(int, open(0).read().split())
    ans = abs(X - A[0])
    for i in A:
        dif = abs(X - i)
        if dif % ans:
            ans = gcd(ans, dif)
    print(ans)


if __name__ == "__main__":
    main()

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

Solution (Python):
import sys
from fractions import gcd

sys_input = sys.stdin.readline

N, X = map(int, sys_input().split())
xxx = list(map(int, sys_input().split()))
xxx = list(map(lambda x: abs(x-X), xxx))

dp = [None] * N
dp[0] = xxx[0]

for i, x in enumerate(xxx):
    if i == 0:
        continue
    dp[i] = gcd(dp[i-1], x)

print(dp[N-1])

Solution (Python):
import fractions
N, X= map(int,input().split())
x = list(map(int,input().split()))
for i in range(N):
  x[i] = abs(X - x[i])

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

Solution (Python):


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


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

if __name__ == '__main__':
    main()

Solution (Python):
import fractions

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


y=[]
for i in range(N):
  y.append(x[i+1]-x[i])


max_gcd=y[0]
for i in range(N):
  max_gcd=fractions.gcd(max_gcd,y[i])
print(max_gcd)

Solution (Python):
import fractions
N, X= map(int,input().split())
x = list(map(int,input().split()))
for i in range(N):
  x[i] = abs(X - x[i])

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

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


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


y = [abs(X - x[0])]
for i in range(len(x) - 1):
    y.append(abs(x[i + 1] - x[i]))

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

Solution (Python):
from fractions import gcd

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

for i in range(n):
    y[i]=abs(y[i]-x)

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

Solution (Python):
import sys
input = sys.stdin.readline

import fractions

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

tmp=dis[0]
for i in range(1,N):
    tmp = fractions.gcd(tmp,dis[i])
print(tmp)

Solution (Python):
import numpy as np
import math
import fractions
from functools import reduce

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

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

n, x_init = map(int, input().split())
x_list = list(map(int, input().split()))

x_list.sort()

x_list_np = np.asarray(x_list)

idx = np.abs(x_list_np - x_init).argmin()

if x_list[idx]==x_init:
    pass
elif x_list[idx]<x_init:
    x_list_np = np.insert(x_list_np, idx+1, x_init)
else:
    x_list_np = np.insert(x_list_np, idx, x_init)

x_list_np_diff = x_list_np[:-1] - x_list_np[1:]

print(np.abs(gcd(*x_list_np_diff)))

Solution (Python):
def gcd1(x,y):
    d = x % y
    while d != 0:
        x,y = y,d
        d = x % y
    return y

def gcd(x,y):
    if x < y:
        x,y = y,x
    return gcd1(x,y)

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

xList.append(X)
xList.sort()
dList = []
for i in range(len(xList)-1):
    d = xList[i+1]-xList[i]
    dList.append( d )

if len(dList) == 1:
    print( dList[0])
else:
    d = gcd(dList[0],dList[1])
    for i in range(2,len(dList)):
        d = gcd(d,dList[i])
    print(d)

Solution (Python):
from fractions import *
N,X0=map(int,input().split())
X=list(map(int,input().split()))
ans=abs(X[0]-X0)
for i in range(1,N):
    ans=gcd(ans,abs(X[i]-X0))
print(ans)

Solution (Python):
import fractions
N,X0=map(int,input().split())
X=list(map(int,input().split()))
X_=[]
ans=abs(X[0]-X0)
for i in range(1,N):
    ans=fractions.gcd(ans,abs(X[i]-X0))
print(ans)

Solution (Python):
n, x = map(int, input().split())
li = list(map(int, input().split()))
t = []
for i in li:
    t.append(abs(i - x))
divisors = []
for i in range(1, int(min(t) ** 0.5) + 1):
    if min(t) % i == 0:
        divisors.append(i)
        if i != min(t) // i:
            divisors.append(min(t) // i)
divisors.sort()
divisors = divisors[::-1]
for j in divisors:
    if all(k % j == 0 for k in t):
        print(j)
        exit()

Solution (Python):
import fractions

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

Solution (Python):
n, x = map(int, input().split())
xs = list(map(int, input().split()))
ds = [abs(y - x) for y in xs]


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


ds = sorted(ds, reverse=True)
res = ds[0]
for d in ds[1:]:
    if d == 0:
        continue
    res = gcd(res, d)
print(res)

Solution (Python):
import fractions
import numpy as np
n,x=map(int,input().split())
li=np.array(input().split(),dtype=np.int64)

li=abs(li-x)

if n==1:
    print(li[0])
else:
    ans=0
    for i in li:
        ans=fractions.gcd(ans,i)
    print(ans)

Solution (Python):
import fractions as math
import sys
N, X = map(int, input().split())

dis_list = [abs(int(i) - X) for i in input().split()]
if len(dis_list) < 2:
    print(dis_list[0])
    sys.exit()


first_gc = math.gcd(dis_list[0], dis_list[1])

for i in range(len(dis_list)):
    first_gc = math.gcd(first_gc, dis_list[i])

print(first_gc)

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

Solution (Python):
import fractions

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

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

res = diff[0]
for i in range(N - 1):
    res = fractions.gcd(res, diff[i + 1])

print(res)

Solution (Python):
from fractions import gcd

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

tmp = [0] * N
x.sort()
tmp[0] = abs(X - x[0])

for i in range(N - 1):
    tmp[i + 1] = x[i + 1] - x[i]

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

print(ans)

Solution (Python):
def gcd(x,y):
  if y == 0:
    return x
  else:
    return gcd(y,x%y)
n,x = map(int,input().split())
X = list(map(int,input().split())) + [x]
X.sort()
Dif_X = []
for i in range(n):
    Dif_X += [X[i+1]-X[i]]
gcd_Dif_X = Dif_X[0]
for i in range(n):
    gcd_Dif_X = gcd(gcd_Dif_X,Dif_X[i])
print(gcd_Dif_X)

Solution (Python):
"""


 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())


 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  


a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654


char_list = list("abcd") 
"""

import math
import sys
import itertools
import queue
from fractions import gcd

import functools
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    N,X = map(int, sys.stdin.readline().split())
    x = list(map(int, sys.stdin.readline().split()))
    l=[]
    for i in range(N):
        l.append(abs(X-x[i]))
    ans = reduce(gcd,l)
    print(ans)

Solution (Python):
from functools import reduce
from fractions import gcd
N,X=map(int,input().split())
x=[abs(X-int(i)) for i in input().split()]
print(reduce(gcd,x))

Solution (Python):
from fractions import gcd

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

Solution (Python):
from functools import reduce
import fractions

N, X = map(int,input().split())
x = list(map(int,input().split()))
x = list(map(lambda x:abs(x-X), x))
x = reduce(lambda a,b: fractions.gcd(a,b), x)
print(x)

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

from fractions import gcd

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

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

n,X = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]
list = []
for i in x:
    list.append(abs(i-X))
if n == 1:
    print(abs(x[0]-X))
else:
    mn = 10000000000
    for i in range(1,len(list)):
        mn = min(mn, gcd(list[i-1],list[i]))
    print(mn)

Solution (Python):
import fractions

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

Solution (Python):
n,k = map(int,input().split())
x = list(map(int,input().split()))
ans = 0
t = 0
 
def gcd(a,b):
  while b:
    a,b = b,a%b
  return abs(a)
 
for i in range(n):
    t = abs(x[i]-k)
    ans = gcd(ans,t)
print(ans)

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

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

from fractions import gcd

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

Solution (Python):

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

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

for i in range(n):
    t = abs(x[i]-k)
    ans = gcd(ans,t)
print(ans)

Solution (Python):
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
  
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0]*n
for i in range(n):
  d[i] = abs(l[i]-x)
  
print(gcd_list(d))

Solution (Python):
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
  
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = [0]*n
for i in range(n):
  d[i] = abs(l[i]-x)
  
print(gcd_list(d))

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

def calcgcd(a, b):
  if a > b:
    a, b = b, a
  while a > 0:
    a, b = b%a, a
  return b
r = abs(xs[0])
for x in xs:
  r = calcgcd(r, abs(x))
print(r)

Solution (Python):
from fractions import gcd
from functools import reduce

N, X = map(int,input().split())
xlist = list(map(int, input().split()))
new_xlist = [(x - xlist[0]) for x in xlist]
X -= xlist[0]
print(abs(reduce(gcd, new_xlist + [X])))

Solution (Python):
from functools import reduce
from fractions import gcd
n,x=map(int,input().split())
X=list(map(int,input().split()))
X=[abs(y-x) for y in X]
print(reduce(gcd,X))

Solution (Python):
N,X = map(int,input().split())
list_x = list(map(int,input().split()))

'''考え方
都市の位置をソートする
距離を全て計算
距離の最大公約数を計算
'''

if len(list_x) == 1:
  ans = abs(X-list_x[0])
  print(ans)
  exit()

list_x.sort()
list_dist = []
for i,city in enumerate(list_x):
  if (i == len(list_x) - 1):
    continue
  
  list_dist.append(list_x[i+1] - list_x[i])



_ = min(abs(X-list_x[0]),abs(X-list_x[-1]))
list_dist.append(_)


import fractions
ans = list_dist[0]
len_list_dist = len(list_dist)

for i in range(1, len_list_dist):
    ans = fractions.gcd(ans, list_dist[i])

print(ans)

Solution (Python):
from functools import reduce
from fractions import gcd

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

print(reduce(gcd, [town[i+1] - town[i] for i in range(len(town)-1)]))

Solution (Python):
n, x = map(int, input().split())
xs = list(map(int, input().split()))

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

import numpy as np

xs = np.array(xs)
diffs = abs(xs - x)

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

Solution (Python):
n, x = map(int, input().split())
t = list(map(int, input().split()))

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

ans = 0

for i in t:
  j = abs(x-i)
  if ans == 0:
    ans = j
  else:
    ans = gcd(ans, j)

print(ans)

Solution (Python):
from functools import reduce
from fractions import gcd
N,X = map(int,input().split())
x = list(map(int,input().split()))
list = list(abs(X-i) for i in x)
print(reduce(gcd,list))

Solution (Python):
def gcd(p, q):
    if p < q:
        p, q = q, p
    while q > 0:
        p, q = q, p%q
    return p
n, x = map(int, input().split())
x_list = [abs(int(i)-x) for i in input().split()]
a = x_list[0]
for i in range(1, n):
    a = gcd(a, x_list[i])
print(a)

Solution (Python):
n,X=map(int,input().split())
x=list(map(int,input().split()))
y=[X]*n
new = [abs(a-b) for (a,b) in zip(x,y)]
import fractions
if len(new) == 1:
    print(new[0])
elif len(new) ==2:
    print(fractions.gcd(new[0],new[1]))
else:
    gcd=fractions.gcd(new[0],new[1])
    for i in range(2,len(new)-1):
        gcd=fractions.gcd(gcd,new[i])
    print(gcd)

Solution (Python):
from functools import reduce
from fractions import gcd

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

print(reduce(gcd,x))

Solution (Python):
import fractions
n,x=list(map(int,input().split()))
xi=list(map(int,input().split()))

gc=abs(x-xi[0])
for i in range(n-1):
  sa=abs(xi[i]-xi[i+1])
  gc=fractions.gcd(gc,sa)
print(gc)

Solution (Python):
import fractions

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

if len(x) == 1:
    print(abs(x[0] - X))
else:
    g = x[1] - x[0]
    for i in range(N - 1):
        g = fractions.gcd(g, x[i + 1] - x[i])

    ans = fractions.gcd(g, max(max(x) - X, X - min(x)))
    print(ans)

Solution (Python):
import sys
import math
from fractions import gcd



from functools import reduce

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""


 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())


 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""






N, X =  map(int, sys.stdin.readline().split())
L =  list(map(int, sys.stdin.readline().split()))
L.append(X)
L = sorted(L)
D = [x2 - x1 for x1, x2 in zip(L , L[1::])]
print(reduce(gcd, D))

Solution (Python):
from fractions import gcd
from functools import reduce

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


[n,x]=[int(x) for x in input().split()]
xlist=[int(x) for x in input().split()]+[x,]
xlist.sort()
sabunlist=[xlist[i+1]-xlist[i] for i in range(n)]
print(gcd_list(sabunlist))

Solution (Python):
def make_divisors(n):
    divisors = []
    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)

    divisors.sort(reverse=True)
    return divisors

N,X=map(int,input().split())
x=[abs(X-int(_)) for _ in input().split()]
x.sort()
divisor = make_divisors(x[0])
result=1
for d in divisor:
    for elem in x:
        if elem%d!=0:
            break
        if elem==x[-1]:
            result=d
            break
    if result!=1:
        break
print(result)

Solution (Python):
import fractions
n,x = map(int,input().split())
list_x = list(map(int,input().split()))
ans = list_x[0]
for i in range(n):
  if i == 0:
    ans = abs(x - list_x[i])
  else:
    ans = fractions.gcd(ans,abs(x - list_x[i]))
print(ans)

Solution (Python):
from fractions import gcd

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

ans = 0
for i in nums:
  if ans == 0:
    ans = i
  else:
    ans = gcd(ans, i)
print(ans)

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

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

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

if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin
from fractions import gcd
from functools import reduce
n, x, *xs = map(int, stdin.read().split())
print(reduce(gcd, [abs(xs[i] - x) for i in range(n)]))

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n, x = na()
x_li = na()
li = []
for i in range(n):
    li.append(abs(x - x_li[i]))
import fractions

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