"use strict"

//最大公約数を求める
const gcd = (m, n) => {
  if (n === 0) return m

  return gcd(n, m % n)
}

function main(input) {
  input = input.split(/\n/).map(v => v.split(/\s/).map(v => ~~v))
  const X = input[0][1]
  const distance = input[1].sort((a, b) => a - b).map(v => {
    return v - X
  })
  const ans = distance.reduce((a, b) => {
    return gcd(a, b)
  })
  console.log(Math.abs(ans))
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))
