'use strict';

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

  let list = [];

  for(let i=0; i<N; i++) {
    list.push(Math.abs(Number(input.split('\n')[1].split(' ')[i]) - X));
  }
  list.sort((a, b) => (a > b ? 1 : -1));

  let dif = [];
  for(let j=0; j<N-1; j++){
    if(list[j+1] !== list[j]){
      dif.push(list[j+1] - list[j]);
    }
  }
  dif.sort((a, b) => (a > b ? 1 : -1));

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

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


};

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