import Foundation
//最大公約数を求める関数
func gcd(_ a: Int, _ b: Int) -> Int {
   let r = a % b
   if r != 0 {
       return gcd(b, r)
   } else {
       return b
   }
}
//３つ以上の数の最大公約数を求める
func gcdArr(_ numArr: [Int]) -> Int {
    var ans: Int = numArr[0]
    for i in numArr {
        ans = gcd(ans, i)
    }
    return ans
}


let rl = readLine()!.split(separator: " ").map({Int($0)!})
let N = rl[0]
let X = rl[1]
let xi = readLine()!.split(separator: " ").map({Int($0)!})

let absxi = xi.map({abs($0 - X)})

print(gcdArr(absxi))