CodeEff/ECCO huggingface dataset:
# Original solution
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
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)]
mod = 1000000007


#A
"""
a = LI()
i = a.count(5)
j = a.count(7)
if i == 2 and j == 1:
    print("YES")
else:
    print("NO")
"""

#B
n,l = LI()
s = SR(n)
s.sort()
for i in s:
    for j in i:
        print(j,end = "")
print()
#C
"""
def check(n):
    n = list(map(int,list(str(n))))
    s = 0
    for i in n:
        s += f[i]
    return s == 0
n,k = LI()
d = LI()
f = [0 for i in range(10)]
for i in d:
    f[i] = 1
while 1:
    if check(n):
        print(n)
        quit()
    n += 1
"""
#D
"""
def f(x,y):
    return fact[x-1+h-y]*fact[y-1+w-x]*inv_fact[x-1]*inv_fact[y-1]*inv_fact[w-x]*inv_fact[h-y]%mod
h,w,a,b = LI()
fact = [1]*(h+w+1)
for i in range(h+w):
    fact[i+1] = fact[i]*(i+1)%mod
inv_fact = [0]*(h+w+1)
inv_fact[h+w] = pow(fact[-1],mod-2,mod)
for i in range(h+w)[::-1]:
    inv_fact[i] = inv_fact[i+1]*(i+1)%mod
ans = 0
for i in range(1,min(w-b,h-a)+1):
    ans += f(b+i,a+i)
    ans %= mod
print(ans)
"""


#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
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)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,l = LI()
    s = [input() for i in range(n)]
    s.sort()
    for i in s:
        print(i,end = "")
    print()
    return

#Solve
if __name__ == "__main__":
    solve()
# Original solution
n, l = map(int, input().split())
s = sorted([input() for _ in range(n)])
print(*s, sep='')


# Optimized solution
n, l = map(int, input().split())
print(*sorted([input() for _ in range(n)]), sep='')
# Original solution
import sys
input = sys.stdin.readline
N, L = [int(x) for x in input().split()]
S = []
for _ in range(N):
    S.append(input().rstrip())
S.sort()
print(("".join(S)))

# Optimized solution
import sys
input = sys.stdin.readline

n, l = [int(x) for x in input().split()]

s = [input().rstrip() for _ in range(n)]

s.sort()

print(("".join(s)))
# Original solution
N, L = map(int, input().split())
s = [input() for i in range(N)]
s.sort()
print(*s, sep="")


# Optimized solution
N, L = map(int, input().split())
s = sorted([input() for i in range(N)])
print(*s, sep="")
# Original solution
N,L = map(int,input().split())
S = sorted([input() for n in range(N)])
print(*S,sep="")


# Optimized solution
N,L = map(int,input().split()) 
print(*sorted([input() for n in range(N)]),sep="")
# Original solution
n, l = map(int, input().split())
print(*sorted([input() for i in range(n)]), sep="")


# Optimized solution
n,l = map(int, input().split())
s = []
for _ in range(n):
    s.append(input())
print(*sorted(s), sep='')
# Original solution
from itertools import permutations
N, L = map(int, input().split())
S = [input() for _ in range(N)]
p = list(permutations(S))

print(*sorted(p)[0], sep='')


# Optimized solution
N, L = map(int, input().split())
S = sorted(list(input() for _ in range(N)))
print(*S, sep='')
# Original solution
# -*- coding: utf-8 -*-

n,l = map(int,input().split())
s = [input() for i in range(n)]
s = sorted(s)
print(*s,sep="")



# Optimized solution
n,l = map(int,input().split())
s = sorted([input() for i in range(n)])
print(*s,sep="")
# Original solution
import math
n,x = list(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)

# Optimized solution
N,X = list(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)
# Original solution
import math
n,x=list(map(int,input().split()));l=[abs(x-i) for i in list(map(int,input().split()))]
if len(l)>1:
  r=math.gcd(l[0],l[1])
  for i in range(1,len(l)):
    r=math.gcd(r,l[i])
else:
  print((l[0]))
  exit()
print(r)

# Optimized solution
import math
n,x=list(map(int,input().split()));l=[abs(x-i) for i in list(map(int,input().split()))];r=0
for i in range(len(l)): r=math.gcd(r,l[i])
print(r)
# Original solution
def solve(X, xs):
    divs = list(range(1, int(10 ** 4.5) + 1))
    def divisors(X, smaller_only=False):
        fwd, bwd = [], []
        for p in divs:
            if X % p == 0:
                fwd.append(p)
                if not smaller_only and X // p != p:
                    bwd.append(X // p)
        bwd.reverse()
        return fwd + bwd

    s = None
    for x in xs:
        ds = set(divisors(abs(x - X)))
        if s:
            s &= ds
        else:
            s = ds
    return max(s)

def test():
    print((solve(1, [2 ** i for i in range(30)])))

if __name__=='__main__':
    N, X = list(map(int, input().split()))
    xs = list(map(int, input().split()))

    print((solve(X, xs)))


# Optimized solution
try:
    from math import gcd # >=Python 3.5
except:
    from fractions import gcd # <Python 3.5 (AtCoder : 3.4)

def solve(X, xs):
    xs = list(xs) + [X]
    xs.sort()
    zs = [x - xs[0] for x in xs]

    for z in zs:
        if z == 0:
            D = z
        else:
            D = gcd(D, z)
    return D

def test():
    print((solve(13, [16 + 3 * 102485 * i for i in range(10**5)])))

if __name__=='__main__':
    N, X = list(map(int, input().split()))
    xs = list(map(int, input().split()))

    print((solve(X, xs)))
# Original solution
from math import gcd
from functools import reduce

_, X = list(map(int, input().split()))
x = set(map(int, input().split()))
x.add(X)
x = sorted(x)
print((reduce(gcd, (j - i for i, j in zip(x[:-1], x[1:])))))

# Optimized solution
from math import gcd
from functools import reduce

_, X = list(map(int, input().split()))
print((reduce(gcd, (abs(i - X) for i in set(map(int, input().split()))))))
# Original solution
import math


def main():
    n, s = list(map(int, input().split()))
    xs = sorted(list(map(int, input().split())))

    for i in range(n):
        xs[i] = abs(xs[i] - s)

    for i in range(1, n):
        xs[i] = math.gcd(xs[i], xs[i-1])

    print((xs[n-1]))


if __name__ == "__main__":
    main()


# Optimized solution
from math import gcd


def main():
    n, x = list(map(int, input().split()))
    xs = list(map(int, input().split()))
    xs.append(x)
    xs.sort()
    diff = []
    for i in range(1, n+1):
        diff.append(xs[i] - xs[i-1])
    ans = diff[0]
    for i in range(1, n):
        ans = gcd(ans, diff[i])
    print(ans)


if __name__ == "__main__":
    main()
# Original solution
N, X = list(map(int, input().split()))
x = list(map(int, input().split()))

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y:
        while x%y:
            z = x%y
            x, y = y, x
        else:
            return z
    else:
        return y


x.append(X)
x.sort()
# print(x)
# d = []
# for i in range(N):
#     d.append(x[i+1]-x[i])
# print(d)
for i in range(N):
    if i == 0:
        c = x[i+1]-x[i]
    else:
        c = gcd(x[i+1]-x[i], c)
print(c)


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

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    # if x%y:
    #     while x%y:
    #         z = x%y
    #         x, y = y, x
    #     else:
    #         return z
    # else:
    #     return y
    if y == 0:
        return x
    else:
        return gcd(y, x%y)


x.append(X)
x.sort()
# print(x)
# d = []
# for i in range(N):
#     d.append(x[i+1]-x[i])
# print(d)
for i in range(N):
    if i == 0:
        c = x[i+1]-x[i]
    else:
        c = gcd(x[i+1]-x[i], c)
print(c)
# Original solution
import math

# 最大公約数を求める問題
N, X = list(map(int, input().split()))
x = [int(_) for _ in input().split()]
if N == 1:
    print((abs(x[0]-X)))
    exit()

x.sort()
# N > 1と仮定
for i in range(N-1):
    if x[i] < X and x[i+1] > X:
        x = x[:i+1] + [X] + x[i+1:]
        break
    elif x[i] >= X:
        x = [X] + x
    elif x[i+1] <= X:
        x = x + [X]

if len(x) >= 3:
    base = math.gcd(x[1]-x[0], x[2]-x[1])
    for i in range(2, N):
        diff = x[i+1] - x[i]
        base = math.gcd(base, diff)
    print(base)
else:
    print((x[1] - x[0]))


# Optimized solution
import math

# 最大公約数を求める問題
N, X = list(map(int, input().split()))
x = [int(_) for _ in input().split()]
if N == 1:
    print((abs(x[0]-X)))
    exit()

x.sort()
# N > 1と仮定
for i in range(N-1):
    if x[i] < X and x[i+1] > X:
        x = x[:i+1] + [X] + x[i+1:]
        break
    elif x[i] >= X:
        x = [X] + x
        break
    elif x[i+1] <= X:
        x = x + [X]
        break

if len(x) >= 3:
    base = math.gcd(x[1]-x[0], x[2]-x[1])
    for i in range(2, N):
        diff = x[i+1] - x[i]
        base = math.gcd(base, diff)
    print(base)
else:
    print((x[1] - x[0]))
# Original solution
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)
    return divisors

def main():
    N, X = list(map(int, input().split()))
    x = list(map(int, input().split()))
    y = [abs(X-a) for a in x]
    cnt = set(make_divisors(y[0]))
    for d in y:
        cnt.intersection_update(make_divisors(d))
        if len(cnt) == 1:
            print((1))
            return
    ans = max(cnt)
    print(ans)

if __name__ == "__main__":
    main()


# Optimized solution
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)
    return divisors

def main():
    N, X = list(map(int, input().split()))
    x = list(map(int, input().split()))
    y = [abs(X-a) for a in x]
    cnt = set(make_divisors(min(y)))
    for d in y:
        tmp = []
        for c in cnt:
            if d%c == 0:
                tmp.append(c)
        cnt.intersection_update(set(tmp))
        if len(cnt) == 1:
            print((1))
            return
    ans = max(cnt)
    print(ans)

if __name__ == "__main__":
    main()
# Original solution
f=lambda:[*list(map(int,input().split()))]
n,x=f()
l=f()
d=[l[i+1]-l[i] for i in range(n-1)]
a=abs(x-l[0])
from math import *
for i in d:
  a=gcd(a,i)
print(a)

# Optimized solution
f=lambda:[*list(map(int,input().split()))]
n,x=f()
d=[abs(i-x) for i in f()]
a=d.pop()
from math import *
for i in d:
  a=gcd(a,i)
print(a)
# Original solution
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == 1:
    print((abs(x-a[0])))
    exit()
else:
    a.sort()
    box = [a[i+1]-a[i] for i in range(n-1)]
    b = min(box)
    for i in range(1,b+1):
        for j in range(n-1):
            if box[j]%i:
                break
            if j == n-2:
                ans = i
    d = abs(x-a[0])
    if ans <= d:
        for i in range(1,ans+1):
            if d%i:
                continue
            else:
                temp = i
        print(temp)
    else:
        for i in range(1,d+1):
            if ans%i:
                continue
            else:
                temp = i
        print(temp)



# Optimized solution
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == 1:
    print((abs(x-a[0])))
    exit()
else:
    a.append(x)
    a.sort()
    box = [a[i+1]-a[i] for i in range(n)]
    b = min(box)
    for i in range(1,b+1):
        for j in range(n-1):
            if box[j]%i:
                break
            if j == n-2:
                ans = i
    print(ans)
# Original solution
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

N,A = list(map(int,input().split()))
X = sorted(map(int,input().split()))
Y = []
for x in X:
    Y.append(abs(A-x))
ans = max(Y)
for y in Y:
    ans = gcd(y,ans)
print(ans)

# Optimized solution
N,S = 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)

new_X = []
for x in X:
    new_X.append(abs(S-x))

ans = new_X[0]
for x in new_X:
    ans = min(ans,gcd(ans,x))
print(ans)
# Original solution
n,m = list(map(int,input().split()))
aa = list(map(int,input().split()))
 
bb = [abs(a-m) for a in aa]

def gcd(a,b):
    while b:
        a, b = b, a % b
    return a
    
if len(aa) == 1:
    print((abs(aa[0]-m)))
else:
    while len(bb) > 1:
        a, b = bb.pop(), bb.pop()
        bb.append(gcd(a,b))
    print((bb[0]))

# Optimized solution
n,m = list(map(int,input().split()))
aa = list(map(int,input().split()))
 
bb = [abs(a-m) for a in aa]


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

    
ans = bb[0]
if len(aa) == 1:
    print((abs(aa[0]-m)))
else:
    for b in bb:
        ans = gcd(ans,b)
    print(ans)
# Original solution
from math import gcd
n,m = list(map(int, input().split()))
x = list(map(int, input().split()))

x.append(m)
x = sorted(x)

dis = [0]*n
for i in range(n): dis[i] = x[i+1] - x[i]

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

# Optimized solution
from math import gcd
n,m = list(map(int, input().split()))
x = list(map(int, input().split()))

x.append(m)
x = sorted(x)
l = [0]*n
for i in range(n): l[i] = x[i+1] - x[i]

ans = l[0]
for i in range(1,n): ans = gcd(ans,l[i])
print(ans)
# Original solution
from math import gcd
n,m = list(map(int, input().split()))
x = list(map(int, input().split()))

x.append(m)
x = sorted(x)
l = [0]*n
for i in range(n): l[i] = x[i+1] - x[i]

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

# Optimized solution
from math import gcd
n,x = list(map(int, input().split()))
l = sorted([x]+list(map(int, input().split())))

nums = [0]*n
for i in range(n): nums[i] = l[i+1] - l[i]

ans = nums[0]
for i in range(1,n):
  ans = gcd(ans,nums[i])
print(ans)
# Original solution
N, X = [int(i) for i in input().split()]
x_ls = [int(i) for i in input().split()]
x_ls = [abs(x - X) for x in x_ls]
while True:
    if all([x % min(x_ls) == 0 for x in x_ls]):
        break
    else:
        x_ls = [x % min(x_ls) for x in x_ls]
    x_ls = [x for x in x_ls if x != 0]
print((min(x_ls)))

# Optimized solution
N, X = [int(i) for i in input().split()]
x_ls = [int(i) for i in input().split()]
x_ls = [abs(x - X) for x in x_ls]
while True:
    min_x = min(x_ls)
    x_ls = [x % min_x for x in x_ls]
    if not any(x_ls):
        break
    x_ls = [x for x in x_ls if x != 0]
print(min_x)
# Original solution
n,x=list(map(int,input().split()))

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

X.append(x)

X.sort()

dif=[]
for i in range(n):
    dif.append(X[i+1]-X[i])

for j in range(max(dif),0,-1):
    if all(x%j==0  for x  in dif):
        print(j)
        break

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

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

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

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

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

    
    
print(ans)
# Original solution
from functools import reduce
from collections import Counter

N, X = list(map(int, input().split()))
loc = list(map(int, input().split()))
mem = {}

def prime_factors(n):
    if mem.get(n) is not None:
        return mem[n]
    else:
        i = 2
        factors = []
        while i*i <= n:
            if n % i == 0:
                factors.append(i)
                n = n // i
            else:
                i += 1
        if n > 1:
            factors.append(n)
        mem[n] = factors
    return factors


def find_shared_factors(factor1, factor2):
    counters = [Counter(factor1), Counter(factor2)]
    if len(factor1) > 0 and len(factor2) > 0:
        return list(reduce(lambda x, y: x & y, counters).elements())
    elif len(factor2) == 0:
        return factor1
    else:
        return factor2

factors = []
for l in loc:
    factors = find_shared_factors(prime_factors(abs(l-X)), factors)
for i in range(N):
    for j in range(N):
        if i < j:
            factors = find_shared_factors(prime_factors(abs(loc[i]-loc[j])), factors)

r = reduce(lambda x,y: x*y, factors) if len(factors) > 0 else abs(max(loc)-X)

print(r)

# Optimized solution
from functools import reduce
N, X = list(map(int, input().split()))
loc = list(map(int, input().split()))


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


print((reduce(gcd, [abs(l-X) for l in loc])))
# Original solution
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)


# Optimized solution
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)
# Original solution
N, X = list(map(int, input().split()))
x    = list(map(int, input().split()))

y = [abs(xi - X) for xi in x]
k = min(y)

for i in range(k):
    p = k -i
    z = [yi % p for yi in y]
    if sum(z) == 0:
        print(p)
        break


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


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

y = [abs(xi - X) for xi in x]
r = y[0]

for i in range(N-1):
    if y[i+1] != 0:
        r = gcd(r, y[i+1])

print(r)
# Original solution
N, X = list(map(int, input().split()))
A = list(map(int, input().split()))

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

D = []
for a in A:
  D.append(abs(X - a))

answer = 0
for d in D:
  answer = gcd(answer, d)

print(answer)

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

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

answer = 0
for a in A:
  answer = gcd(answer, a)

print(answer)
# Original solution
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()))
if len(x) == 1:
  print((abs(x[0] - X)))
else:
  x.sort()
  s = x[1] - x[0]
  for i in range(1, n-1):
    s = gcd(s, x[i+1]-x[i])
  a = 1
  for i in range(n):
    a = max(a, gcd(abs(X-x[i]), s))
  print(a)

# Optimized solution
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()))
a = abs(x[0] - X)
for i in x[1:]:
  a = gcd(a, abs(i - X))
print(a)
# Original solution
a=list(map(int,input().split()))
b=[]
for i in input().split():
  b.append(abs(int(i)-a[1]))
def ucl(a,b):
  if a%b==0:
    return b
  else:
    return ucl(b,a%b)
while len(b)>1:
  b.append(ucl(b[0],b[1]))
  del b[0],b[1]
print((b[0]))  

# Optimized solution
a=list(map(int,input().split()))
x=[]
for i in input().split():
  x.append(abs(int(i)-a[1]))
def ucl(a,b):
  if a%b==0:
    return b
  else:
    return ucl(b,a%b)
while len(x) > 1:
  x2 = []
  mn_x = min(x)
  for n in range(len(x)):
    mod = x[n] % mn_x
    if mod != 0:
      x2.append(mod)
  x2.append(mn_x)
  x = x2
print((x[0]))
# Original solution
N, X = list(map(int, input().split()))
axis = list(map(int, input().split()))

ans = abs(axis[0] - X)

def gcd(n, m) :
    n, m = max(n, m), min(n, m)
    if m == 0 :
        return n
    return gcd(m, n % m)

for a in axis :
    ans = gcd(ans, abs(a - X))

print(ans)

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

def gcd(n, m):
    if m == 0:
        return n
    return gcd(m, n % m)

B = [abs(a - A[0]) for a in A]
ans = 0
for d in B:
    ans = gcd(ans, d)
print(ans)
# Original solution
import collections

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

y = [abs(X-i) for i in x]
y.append(0)
y.sort()
z = [(y[i+1] - y[i]) for i in range(0, N)]
zz = []
for i in range(0, N):
    if z[i] != 0 and not(z[i] in zz):
        zz.append(z[i])
a = list(collections.Counter(zz).keys())
D = min(a)
f = True
for i in range(D, 0, -1):
    f = True
    for j in range(0, N):
        if y[j]%D != 0:
            f = False
            break
    if f:
        break
    D = i
print(D)

# Optimized solution
import collections

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

y = [abs(X-i) for i in x]
y.append(0)
y.sort()
z = [(y[i+1] - y[i]) for i in range(0, N) if (y[i+1] - y[i]) != 0]
z = list(set(z))
a = list(collections.Counter(z).keys())
D = min(a)
f = True
for i in range(D, 0, -1):
    f = True
    for j in range(0, N):
        if y[j]%D != 0:
            f = False
            break
    if f:
        break
    D = i
print(D)
# Original solution
import collections

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

y = [abs(X-i) for i in x]
y.append(0)
y.sort()
z = [(y[i+1] - y[i]) for i in range(0, N) if (y[i+1] - y[i]) != 0]
z = list(set(z))
a = list(collections.Counter(z).keys())
D = min(a)
f = True
for i in range(D, 0, -1):
    f = True
    for j in range(0, N):
        if y[j]%D != 0:
            f = False
            break
    if f:
        break
    D = i
print(D)

# Optimized solution
import collections

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

y = [abs(X-i) for i in x]
y.append(0)
y.sort()
D = min(collections.Counter(list(set([(y[i+1] - y[i]) for i in range(0, N) if (y[i+1] - y[i]) != 0]))).keys())
f = True
for i in range(D, 0, -1):
    f = True
    for j in range(0, N):
        if y[j]%D != 0:
            f = False
            break
    if f:
        break
    D = i
print(D)
# Original solution
def gcd(a, b):
  if(b % a == 0):
    return a
  elif(a % b == 0):
    return b
  else:
    ans = 1
    i = 2
    while a!= 1:
      if(a % i == 0):
        while a % i == 0:
          a/= i
        while b % i == 0:
          b/= i
          ans*= i
        i+= 1
    return ans
          

def ggcd(lista):
  if(len(lista) == 1):
    return lista.pop()
  else:
    l = lista.pop()
    for i in range(1, len(lista)):
      l = gcd(l, lista.pop())
    return l

N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
d = []
gcds = set()
x.sort()

for i in range(N):
  d.append(x[i+ 1]- x[i])
  
gcds.add(d[0])

for i in range(N- 1):
  if(d[i+ 1] != d[i]):
    gcds.add(d[i+ 1])

print((ggcd(gcds)))

# Optimized solution
def gcd(a, b):
  if(a == b):
    return a
  elif(a % b == 0):
    return b
  elif(b % a == 0):
    return a
  elif(a == 1 or b == 1):
    return 1
  elif(a > b):
    return gcd(a- a// b* b, b)
  elif(a < b):
    return gcd(a, b- b// a* a)

def ggcd(lista):
  if(len(lista) == 1):
    return lista.pop()
  else:
    l = lista.pop()
    for i in range(1, len(lista)):
      l = gcd(l, lista.pop())
    return l

N, X = list(map(int, input().split()))
x = list(map(int, input().split()))
x.append(X)
d = []
gcds = set()
x.sort()

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

gcds.add(d[0])

for i in range(N- 1):
  if(d[i+ 1] != d[i]):
    gcds.add(d[i+ 1])

print((ggcd(gcds)))