#include <bits/stdc++.h>
using namespace std;

int gcd(int a, int b){
  if(b == 0) return a;
  return gcd(b, a % b);
}

int main(){
  int N, X;
  cin >> N >> X;
  int x[N];
  int ans = 0;
  for(int i = 0; i < N; i++){
    cin >> x[i];
    x[i] -= X;
    ans = gcd(ans, x[i]);
  }
  cout << abs(ans) << endl;
  return 0;
}
