As lockdown is going on so no is allowed to go outside , so Chef has come with an innovative idea for food home delivery using drone.  But there is an issue with it , the drone can move forward or backward a fix number of steps $x$ . 
All the houses and chef restaurant are all in a straight line . Homes which need delivery are located at $H[i]$ and chef is located at $y$ coordinate . 
If Drone is at a location $R$, then it can move to $R-x$ or $R+x$ . 
Help chef find maximum value of $x$ to complete all the deliveries as he is busy managing the orders.

-----Input:-----
- First line will contain $n$ and $R$, number of houses that need delivery and the correct coordinate of chef (Drone).
- Second line contains $n$ integers , the coordinate of all homes that need delivery. 

-----Output:-----
- The maximum value of $x$ , so that drone delivers to all houses.

-----Constraints-----
- $1 \leq n \leq 1000$
- $1 \leq R \leq 10^9$
- $1 \leq hi \leq 10^9$
- $1 \leq x  \leq 10^9$

-----Sample Input:-----
3 1
3 5 11

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

-----EXPLANATION:-----
Chef's drone is at 1 initially and he needs to visit 3,5,11 , so optimal solution will be (maximum value of x ) equal to 2.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import math
try:
	(n, d) = map(int, input().split())
	a = list(map(int, input().split()))
	a.sort()
	z = abs(a[0] - d)
	for j in range(n):
		x = abs(a[j] - d)
		z = math.gcd(x, z)
	print(z)
except:
	pass


(n, r) = map(int, input().split())
h = list(map(int, input().split()))
d = [abs(r - h[0])]

def hcf(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
for i in range(len(h) - 1):
	d.append(abs(h[i + 1] - h[i]))
for i in range(len(d) - 1):
	d[i + 1] = hcf(d[i], d[i + 1])
print(d[-1])


from math import fabs
import sys
sys.setrecursionlimit(10 ** 6)

def f(x):
	return int(fabs(x - r))

def gcd(a, b):
	if b == 0:
		return a
	return gcd(b, a % b)
(n, r) = map(int, input().split())
li = list(map(int, input().split()))
li = list(map(f, li))
result = li[0]
for i in li[1:]:
	result = gcd(result, i)
print(result)


def gcd(a, b):
	while b > 0:
		(a, b) = (b, a % b)
	return a
a = [4, 10, 16, 14]
(n, r) = map(int, input().split())
lst = [r]
lst.extend(list(map(int, input().split())))
nlst = []
for i in range(0, n - 1):
	nlst.append(lst[i + 1] - lst[i])
result = nlst[0]
for i in nlst[1:]:
	result = gcd(result, i)
print(result)


import math
(n, k) = map(int, input().split())
ls = list(map(int, input().split()))
ls.append(k)
ls.sort()
if len(ls) > 2:
	z = math.gcd(ls[1] - ls[0], ls[2] - ls[1])
	for i in range(3, len(ls)):
		z = math.gcd(ls[i] - ls[i - 1], z)
else:
	z = ls[1] - ls[0]
print(z)


import math
(n, r) = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
a = sorted(a + [r])
diff = []
for i in range(0, len(a) - 1):
	diff.append(abs(a[i + 1] - a[i]))
if len(diff) == 1:
	print(diff[0])
else:
	flag = 0
	g = math.gcd(diff[0], diff[1])
	for i in range(2, len(diff)):
		if g == 1:
			print(g)
			flag = 1
			break
		g = math.gcd(diff[i], g)
	if flag == 0:
		print(g)


from math import gcd
from functools import reduce

def find_gcd(list):
	x = reduce(gcd, list)
	return x
(N, D) = [int(i) for i in input().split()]
H = [abs(int(i) - D) for i in input().split()]
print(find_gcd(H))


def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
(n, r) = list(map(int, input().split()))
l = list(map(int, input().split()))
b = [l[0] - r]
for i in range(n - 1):
	b.append(l[i + 1] - l[i])
num1 = b[0]
num2 = b[1]
gcd = find_gcd(num1, num2)
for j in range(2, len(b)):
	gcd = find_gcd(gcd, b[i])
print(gcd)


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

def lcm(a, b):
	return a * b // gcd_(a, b)
(n, r) = map(int, input().split())
l = list(map(int, input().split()))
k = []
for i in range(n):
	k.append(l[i] - r)
gcd = k[0]
for i in range(1, len(k)):
	gcd = gcd_(gcd, k[i])
print(gcd)


from math import fabs

def f(x):
	return int(fabs(x - r))
(n, r) = list(map(int, input().split()))
li = list(map(int, input().split()))
li = list(map(f, li))
for z in range(min(li), 0, -1):
	for k in li:
		if k % z != 0:
			break
	else:
		ans = z
		break
try:
	print(ans)
except Exception:
	print(1)


(num, loc) = map(int, input().split())
houses = list(map(int, input().split()))
ans = 10 ** 9
temp = []
for i in range(num):
	diff = abs(houses[i] - loc)
	if diff != 0:
		temp.append(diff)
temp.sort()
x = temp[0]
for i in range(len(temp)):
	if temp[i] % x == 0:
		continue
	else:
		x = 1
		break
print(x)


import math
(n, r) = list(map(int, input().split()))
l = list(map(int, input().split()))
a = []
for i in range(len(l)):
	a.append(abs(r - l[i]))
num1 = a[0]
num2 = a[1]
gcd = math.gcd(num1, num2)
for i in range(2, len(a)):
	gcd = math.gcd(gcd, a[i])
print(gcd)


import math
(n, r) = map(int, input().split())
l = list(map(int, input().split()))
ans = 0
for i in range(len(l)):
	ans = math.gcd(ans, abs(l[i] - r))
print(ans)


(n, r) = map(int, input().split())
h = list(map(int, input().split()))
if r not in h:
	h.append(r)
h.sort()
d = [abs(h[i + 1] - h[i]) for i in range(n - 1)]
m = max(d)
ans = 0
for i in range(m, 0, -1):
	if any([j % i != 0 for j in d]):
		continue
	else:
		ans = i
		break
print(ans)


def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)
(n, r) = input().split()
a = list(map(int, input().split()))
c = []
for i in range(len(a) - 1):
	c.append(a[i + 1] - a[i])
c.append(abs(a[0] - int(r)))
res = c[0]
for d in c[1:]:
	res = gcd(res, d)
print(res)


def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
(n, r) = list(map(int, input().split()))
l = list(map(int, input().split()))
for (i, ele) in enumerate(l):
	if ele > 0:
		l[i] -= r
	else:
		l[i] += r
num1 = l[0]
num2 = l[1]
gcd = find_gcd(num1, num2)
for i in range(2, len(l)):
	gcd = find_gcd(gcd, l[i])
print(gcd)


import math

def gcda(l):
	num1 = l[0]
	num2 = l[1]
	gcdf = math.gcd(num1, num2)
	for i in range(2, len(l)):
		gcdf = math.gcd(gcdf, l[i])
	return gcdf
(n, R) = list(map(int, input().split()))
arr = list(map(int, input().split()))
arr.append(R)
arr = sorted(arr)
ans = 99999999999999
listo = []
for i in range(n - 1):
	listo.append(min(ans, arr[i + 1] - arr[i]))
print(gcda(listo))


from sys import stdin, stdout
import bisect
from collections import defaultdict

def main():
	(n, d) = map(int, stdin.readline().split())
	arr = [int(k) for k in stdin.readline().split()]
	arr.sort()
	ind = bisect.bisect_left(arr, d)
	diff = -1
	if ind != n and arr[ind] == d:
		if ind == n - 1:
			diff = abs(arr[ind - 1] - d)
		else:
			diff = min(abs(arr[ind + 1] - d), abs(arr[ind - 1] - d))
	elif ind == n:
		diff = abs(arr[ind - 1] - d)
	else:
		diff = abs(arr[ind] - d)
	counter = 0
	for i in range(1, n):
		if abs(arr[i] - arr[i - 1]) % diff != 0:
			counter = 1
			break
	if counter == 1:
		print(1)
	else:
		print(diff)

def __starting_point():
	main()
__starting_point()


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

def gcd(l):
	m = math.gcd(l[0], l[1])
	for t in l[2:]:
		m = math.gcd(m, t)
	return m
l = list((int(i) for i in input().split()))
l1 = list([abs(x - r) for x in l])
print(gcd(l1))