local function qiuyu(x, y)
	if x > y then
		local t = x
		x = y
		t = t
	end
	local a = x % y
	if a == 0 then
		return y
	else
		return qiuyu(y, a)
	end
end

local n = io.read("*n")
local x = io.read("*n")
local last = nil
for i = 1, n do
	local tmp = io.read("*n")
	local tmp2 = math.abs(tmp - x)
	if last then
		last = qiuyu(last, tmp2)
	else
		last = tmp2
	end
end
print(last)