let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let x = (readLine()!.characters.split(" ").map{Int(String($0))!}+[input[1]]).sort()
let d = (0..<input[0]).map{x[$0+1]-x[$0]}
var ans = 0
for i in d {
    var (a, b) = (i, ans)
    while b > 0 {
        (a, b) = (b, a%b)
    }
    ans = a
}
print(ans)