#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 log; cin>>log;
  log=abs(log-X);
  for(int i=0;i<n-1;i++){
    int x; cin>>x;
    log=gcd(log,abs(x-X));
  }cout<<log<<endl;
}