#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define repx(i,x,n) for(int i=x; i<(n); ++i)
#define fixed_setprecision(n) fixed << setprecision((n))
#define execution_time(ti) printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
#define pai 3.1415926535897932384
#define NUM_MAX 2e18
#define NUM_MIN -1e9
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }
/*
name: gcd
proc: ユークリッドの互除法
*/
int gcd(int x, int y){
if(x<y) swap(x, y);
while(y>0){
int r = x % y;
x = y;
y = r;
}
return x;
}
int main() {
int N, X;
cin >> N >> X;
vector<int> A(N);
for(auto &a:A) cin >> a;
vector<int> d(N);
for(int i=0; i<N; i++){
d[i] = abs(A[i] - X);
}
if(N==1){
cout << d[0] << endl;
}else{
int ans = gcd(d[0], d[1]);
for(int i=2; i<N; i++){
ans = gcd(d[i], ans);
}
cout << ans << endl;
}
return 0;
}