#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
using namespace std;
int gcd(int a,int b){
	while(b!=0){
		int tmp=a;
		a=b;
		b=tmp%b;
	}
	return a;
}
int main(){
	int n,m;
	cin>>n>>m;
	int ans=0;
	for(int i=0;i<n;i++){
		int k;
		cin>>k;
		ans=gcd(ans,abs(k-m));
	}
	cout<<ans<<endl;
	return 0;
}
/*
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
using namespace std;

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n,m;
	cin>>n>>m;
	vector<int> v;
	v.push_back(m);
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	if(v.size()==2){
		cout<<v[1]-v[0]<<endl;
		return 0;
	}
	int ans=__gcd(v[1]-v[0],v[2]-v[1]);
	for(int i=3;i<v.size();i++){
		ans=__gcd(ans,v[i]-v[i-1]);
	}
	cout<<ans<<endl;
	return 0;
}
*/
/*
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
using namespace std;

int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	int n,m;
	cin>>n>>m;
	vector<int> v;
	v.push_back(m);
	for(int i=0;i<n;i++){
		int a;
		cin>>a;
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	int ans=0;
	for(int i=1;i<v.size();i++){
		ans=__gcd(ans,v[i]-v[i-1]);
	}
	cout<<ans<<endl;
	return 0;
}
*/
/*
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
using namespace std;
int n,m;
int a[100010];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n>>m;
	for(int i=0;i<n;i++)cin>>a[i];
	vector<int> v;
	v.push_back(abs(m-a[0]));
	for(int i=0;i<n-1;i++)v.push_back(abs(a[i]-a[i+1]));
	int ans=v[0];
	for(int i=1;i<v.size();i++)ans=__gcd(ans,v[i]);
	cout<<ans<<endl;
	return 0;
}
*/
/*
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <string.h>
using namespace std;
int cnt[100010];
int res[100010];
int a[100010];
int main(){
	int n,m;
	cin>>n>>m;
	int b=0;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<n;i++){
		cnt[b]=abs(a[i]-m);
		b++;
	}
	sort(cnt,cnt+n);
	int x=cnt[0];
	int c=0;
	for(int i=1;i*i<=x;i++){
		if(x%i==0){
			res[c]=i;
			c++;
			res[c]=x/i;
			c++;
		}
	}
	sort(res,res+c);
	for(int i=c-1;i>=0;i--){
		bool flag=true;
		int ans=m;
		for(int j=0;j<n;j++){
			if(abs(a[j]-ans)%res[i]!=0){
				flag=false;
				break;
			}
			ans=a[j];
		}
		if(flag){
			cout<<res[i]<<endl;
			return 0;
		}
	}
	return 0;
}
*/

Measured memory_bytes: 256