func gcd(x: Int, _ y: Int) -> Int {
    if y == 0 {
        return x
    } else {
        return gcd(y, x%y)
    }
}
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let x = (readLine()!.characters.split(" ").map{Int(String($0))!} + [input[1]]).sorted()
let d = (1...input[0]).map{x[$0] - x[$0-1]}
var ans = 0
for i in d {
    ans = gcd(i, ans)
}
print(ans)