"use strict";
function gcd(a) {
    var f = (a, b) => b ? f(b, a % b) : a;
    var ans = a[0];
    for (var i = 1; i < a.length; i++) {
        ans = f(ans, a[i]); 
    }
    return ans;
}
function Main(input) {
    let lines = input.split("\n");
    let cols = lines[0].split(/\s/).map((v) => v - 0);
    let N = cols[0], X = cols[1];
    let x = lines[1].split(/\s/).map((v) => v - 0);
    let y = x.map((v) => Math.abs(X - v));
    console.log(gcd(y));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
