n = io.read("*n")
x = io.read("*n")
s = {}
for i = 1, n do
	s[i] = io.read("*n")
end

function d(m, n)
	while true do
		r = m%n
		m = n
		n = r
		if r == 0 then
			break
		end
	end
	return m
end

ret = nil
for i = 1, n do
	if s[i] ~= x then
		if ret == nil then
			ret = math.abs(s[i] - x)
		else
			ret = d(ret, math.abs(s[i]-x))
		end
	end
end
print(ret)