'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(Number(input.split('\n')[1].split(' ')[i]));
  }

  Xlist.push(X);
  Xlist.sort((a, b) => (a > b ? 1 : -1));

  let difflist = [];

  for(let j=0; j<N; j++) {
    let diff = Xlist[j+1] - Xlist[j];
    if(difflist.indexOf(diff) === -1) {
        difflist.push(Xlist[j+1] - Xlist[j]);
    }
  }

  const gcd = (m, n) => {
    if(n === 0) {
      return m;
    } else {
      return gcd(n, m % n);
    }
  }

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

    console.log(gcdans);
  }


};

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