function gcd(a, b) {
    if (b === 0)
        return a;

    return gcd(b, a % b);
}

function main(arg) {
    arg = arg.split("\n")
    var tmp = arg[0].split(" ")
    var N = tmp[0]
    var X = tmp[1]
    var xi = arg[1].split(" ")
    
    X = Number(X)
    xi = xi.map(function(e){return Math.abs(parseInt(e,10)-X)})
    
    xi.sort(function(a,b) {
        if (a > b) {
            return 1
        }
        return -1
    })
    
    var ans = xi[0]
    for (var j = 1; j < xi.length;j++) {
        ans = gcd(
            xi[0],
            xi[j]
        )
    }
    console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
