'use strict';

function Main(input) {
  const N = Number(input.split('\n')[0].split(' ')[0]);
  const X = Number(input.split('\n')[0].split(' ')[1]);

  let Xlist = [];

  for(let i=0; i<N; i++) {
    Xlist.push(Math.abs(Number(input.split('\n')[1].split(' ')[i]) - X));
  }
  
  const gcd = (m, n) => {
    if(n === 0) {
      return m;
    } else {
      return gcd(n, m % n);
    }
  }

  if(Xlist.length === 1) {
    console.log(Xlist[0] - X);
  } else {
    let gcdans = gcd(Xlist[0], Xlist[1]);
    for(let k=1; k<N-1; k++) {
      gcdans = gcd(gcdans, Xlist[k]);
    }

    console.log(gcdans);
  }


};

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
