process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(input) {
    var a = input.split("\n").slice(0,-1);
    var y = parseInt(a[0].split(" ").slice(-1))
    var x = a[1].split(" ").map(n => parseInt(n));
    var d = x.map(n => Math.abs(y-n));
    
    var ans = 1;

    function gcd(m, n){
      var r;

      if (m < n){
        r = m;
        m = n;
        n = r;
      }

      while ((r = m % n) != 0) {
      m = n;
      n = r;
      }
      
      return n;
    };

    var ans = d.reduce((acc, cur) => { return gcd(acc, cur)});

    //console.log(a,y,x,d);

    console.log(ans);
} );
process.stdin.on('end', function() {
});