function yakusu(n) {
  var list = []
  for (var i = 1; i < n; i++) {
    if (n % i != 0) continue
    var wari = Math.floor(n / i)
    list.push(wari)
    if (wari <= 1) {
      break
    }
  }
  return list
}


function gcd(a, b) {
  if (b == 0) return a
  return gcd(b, a % b)
}

function saikou(list) {
  var hash = {}
  var len = list.length

  var tmp = 0
  for (var i = 0; i < len; i++) {
    if (tmp == 0) {
      tmp = list[i]
    } else {
      tmp = gcd(tmp, list[i])
    }
  }

  return tmp
}

function pr(s) {
  console.log(s)
}

(function(input) {
  'use strict';

  var N = null
  var X = null
  var xs = []
  input.split("\n").some(function(line) {
    if (N == null) {
      var list = line.split(' ')
      N = parseInt(list[0], 10)
      X = parseInt(list[1], 10)
      return false
    } else {
      xs = line.split(' ').map((x) => { return parseInt(x, 10) })
      return true
    }
  })

  // xs.length <= 1の処理
  if (xs.length <= 1) {
    pr(xs[0] - X)
    return
  }

  var abss = []
  xs.forEach((x) => {
    if (x < X) {
      abss.push(X - x)
    } else {
      abss.push(x - X)
    }
  })

  // debug
  // console.log('N')
  // console.log(N)
  // console.log('X')
  // console.log(X)
  // console.log(xs)

  console.log(saikou(abss))
})(require('fs').readFileSync('/dev/stdin', 'utf8'))
