local split_space = function(str)
  words = {}
  for word in str:gmatch("%w+") do
    table.insert(words, tonumber(word))
  end
  return words
end

gcd = function(a, b)
  if b ~= 0 then
    return gcd(b, a % b)
  else
    return math.abs(a)
  end
end

local nx = split_space(io.read("*l"))
local data = split_space(io.read("*l"))
if #data == 1 then
  print(data[1] - 1)
  os.exit(0)
end
table.insert(data, nx[2])
table.sort(data)
local ans = 0
local diff = {}
for i=1, #data-1 do
  local d1 = data[i+1] - data[i]
  table.insert(diff, d1)
end
ans = gcd(diff[1], diff[2])
for i=3, #diff do
  local tmp = gcd(ans, diff[i])
  if tmp > ans then
    ans = tmp
  end
end
print(ans)