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 x = i
    while ans > 0 {
        (x, ans) = (ans, x % ans)
    }
    ans = x
}
print(ans)