console.log((args=>{
  const [[N,X],x] = args.trim().split('\n').map( r=>r.split(' ').map(v=>v|0) );
  const gcd = (a,b) => {while(a)[a,b]=[b%a,a]; return b;};
  let d = Math.abs(x[0]-X);
  for ( let i = 1; i < N; i++ ) {
    d = gcd( d, Math.abs(x[i]-X) );
  }
  return `${d}`;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
