local n, k = io.read("*n", "*n")
local function getgcd(x, y)
  while(0 < y) do
    x, y = y, x % y
  end
  return x
end
local gcd = math.abs(k - io.read("*n"))
for i = 2, n do
  gcd = getgcd(gcd, k - io.read("*n"))
end
print(gcd)
