Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd
N, X = map(int, input().split())
city = list(map(int, input().split()))
a = []

for i in range(N):
	a.append(abs(city[i] - X))
	a = sorted(a, reverse = True)
	
s = a.pop(0)

while a:
	s = gcd(s, a.pop(0))
	if s == 1:
		break
print(s)

Fixed submission:
from fractions import gcd

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

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])

Buggy python submission (verdict: Time Limit Exceeded):
N, X = map(int, input().split())
city = list(map(int, input().split()))
a = []

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

for i in range(N):
	a.append(abs(city[i] - X))
	a = sorted(a, reverse = True)
	
s = a.pop(0)

while a:
	s = gcd(s, a.pop(0))
	if s == 1:
		break
print(s)

Fixed submission:
from fractions import gcd

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

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
city_lst = list(map(int, input().split()))
city_lst.sort()
dif_lst = []
tmp = city_lst[0]
for i in range(1, N):
	dif_lst.append(city_lst[i] - tmp)
	tmp = city_lst[i]
# print(city_lst)

if X < city_lst[0]:
	maximum_D = city_lst[0] - X
else:
	for i in range(N - 1):
		if city_lst[i] < X:
			maximum_D = min(abs(X - city_lst[i]), abs(city_lst[i + 1] - X))
			break

# print(maximum_D)
for D in reversed(range(1, maximum_D + 1)):
	fail = 0
	# print("D = {}".format(D))
	for dif in dif_lst:
		if dif % D != 0:
			fail = 1
			# print("fail = 1")
			break
	if not fail:
		print(D)
		break

Fixed submission:
from fractions import gcd

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

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
city_lst = list(map(int, input().split()))
city_lst.sort()
dif_lst = []
for i in range(1, N):
	dif_lst.append(city_lst[i] - city_lst[i - 1])
# print(city_lst)

if X < city_lst[0]:
	maximum_D = city_lst[0] - X
else:
	for i in range(N - 1):
		if city_lst[i] < X:
			maximum_D = min(abs(X - city_lst[i]), abs(city_lst[i + 1] - X))
			break

# print(maximum_D)
for D in reversed(range(1, maximum_D + 1)):
	fail = 0
	# print("D = {}".format(D))
	for dif in dif_lst:
		if dif % D != 0:
			# print(city_lst[i], city_lst[i - 1])
			fail = 1
			# print("fail = 1")
			break
	if not fail:
		print(D)
		break

Fixed submission:
from fractions import gcd

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

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
city_lst = list(map(int, input().split()))
city_lst.sort()
# print(city_lst)

if X < city_lst[0]:
	maximum_D = city_lst[0] - X
else:
	for i in range(N - 1):
		if city_lst[i] < X:
			maximum_D = min(abs(X - city_lst[i]), abs(city_lst[i + 1] - X))
			break

# print(maximum_D)
for D in reversed(range(1, maximum_D + 1)):
	fail = 0
	# print("D = {}".format(D))
	for i in range(1, N):
		if (city_lst[i] - city_lst[i - 1]) % D != 0:
			# print(city_lst[i], city_lst[i - 1])
			fail = 1
			# print("fail = 1")
			break
	if not fail:
		print(D)
		break

Fixed submission:
from fractions import gcd

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

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
city_lst = list(map(int, input().split()))
city_lst.sort()

if X < city_lst[0]:
	maximum_D = city_lst[0] - X
else:
	for i in range(N - 1):
		if city_lst[i] < X:
			maximum_D = min(abs(X - city_lst[i]), abs(city_lst[i + 1] - X))
			break

# print(maximum_D)
for D in reversed(range(1, maximum_D + 1)):
	fail = 0
	for i in range(1, N + 1):
		if not (city_lst[i] - city_lst[i - 1]) % D:
			break
	if not fail:
		print(D)
		break

Fixed submission:
from fractions import gcd

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

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])

Buggy python submission (verdict: Runtime Error):
N, X = map(int, input().split())
city_lst = list(map(int, input().split()))
city_lst.sort()

if X < city_lst[0]:
	maximum_D = city_lst[0] - X
else:
	for i in range(N - 1):
		if city_lst[i] < X:
			maximum_D = min(abs(X - city_lst[i]), abs(city_lst[i + 1] - X))
			break

# print(maximum_D)
for D in reversed(range(1, maximum_D + 1)):
	fail = 0
	for i in range(1, N + 1):
		if not city_lst[i] - city_lst[i - 1] == D:
			break
	if not fail:
		print(D)
		break

Fixed submission:
from fractions import gcd

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

x = [abs(int(i) - X) for i in input().split()]  
for i in range(1,N):
	x[i] = gcd(x[i-1], x[i])

print(x[-1])