function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var X = parseInt(input[0].split(" ")[1]);
  x = new Array(N).fill(0);
  tmp=input[1].split(" ");
  for(i=0;i<N;i++){
    x[i]=parseInt(tmp[i]);
  }
  x.push(X);
  x.sort(function(a,b){
    if( a < b ) return -1;
    if( a > b ) return 1;
    return 0;
  });
  dif=new Array();
  for(i=0;i<N;i++){
    if(x[i+1]-x[i]!=0){
    dif.push(x[i+1]-x[i]);
    }
  }
  var ans=0;
  if(dif.length==1){
    ans=dif[0];
  }else{
  for(i=1;i<dif.length;i++){
    if(i==1){
      ans=gcd(dif[i],dif[i-1]);
    }else{
      ans=gcd(ans,dif[i]);
    }
  }
}

  console.log('%s', ans);
}
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;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));