function gcd(u, v)
  while v ~= 0 do
    u, v = v, u%v
  end
  return u
end

N, X = io.read("*n", "*n")
io.read()

x = {}

for v in string.gmatch(io.read(), "(%d+)") do
  table.insert(x, tonumber(v))
end

d = math.abs(X - x[1])

for v = 2, N do
  d = gcd(d, math.abs(X - x[v]))
end

print(d)
