#include <iostream>
#include <algorithm>

using namespace std;

int gcd(int x, int y){
  return x ? gcd(y%x,x) : y;
}

int main(){
  int i,n,x,y,g;
  cin >> n >> x;
  cin >> y;
  g = abs(y-x);
  for(i=1;i<n;i++){
    cin >> y;
    y = abs(y-x);
    g = gcd(g,y);
  }
  cout << g << endl;
  return 0;
}
