var GetCityPos = function(input){
  var arr = input.split('\n');
  var items1 = arr[0].split(' ');
  var items2 = arr[1].split(' ');
  var ModCity = new Set();
  var Min = undefined;

  for(var i =0;i<items2.length;++i){
    var a = items2[i];
    var modCurrentCity = a - items1[1];
    if(modCurrentCity < 0){
      modCurrentCity *= -1;
    }
    ModCity.add(modCurrentCity);

    if(Min == undefined){
      Min = modCurrentCity;
    } else {
      if(Min > modCurrentCity){
        Min = modCurrentCity;
      }
    }
  }
  return {Cities: ModCity, Min: Min};
}

// 割り切れるか確認する関数
var ModZeroCheck = function(CitySet, ModNum){
  var result = true;
  CitySet.forEach(function(value){
    if(!result){
      return;
    }
    if(value%ModNum != 0){
      result = false;
    }
  });
  return result;
}

var Main = function(input){
  // スタート位置を差し引いた位置情報を生成
  var Data = (GetCityPos(input));
  var result = 0;
  // console.log(Data);
  // console.log(Data.Cities);
  // console.log(Data.Cities.size);
  
  if(Data.Cities.size == 1){
    var iterator1 = Data.Cities.values();
    console.log(iterator1.next().value);
    return;
  }

  for(var i = 1; i<=Data.Min;++i){
    if(Data.Min % i != 0){
      continue;
    }
    if(ModZeroCheck(Data.Cities, i)){
      result = i;
    }
  }
  console.log(result);
}

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