//XDDDDDDi
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <deque>
#include <queue>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <bitset>
#include <ctime>
#include <fstream>
#include <limits.h>
#include <numeric>
#include <cassert>
#include <climits>
#include <complex>
#include <streambuf>
#include <typeinfo>
#include <new>
/*
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <tuple>
*/
using namespace std;

#define PB push_back
#define MP make_pair
#define mypair pair<int,int>
#define F first
#define S second
#define mian main
#define ture true

#define MAXN 1000000+5
#define MOD 1000000007
#define PI (acos(-1.0))
#define EPS 1e-6
#define MMT(s,a) memset(s, a, sizeof s)
#define GO(i,a,b) for(int i = (a); i < (b); ++i)
#define GOE(i,a,b) for(int i = (a); i <= (b); ++i)
#define OG(i,a,b) for(int i = (a); i > (b); --i)
#define OGE(i,a,b) for(int i = (a); i >= (b); --i)
typedef unsigned long long ull;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef stringstream sstm;
const int INF = 0x3f3f3f3f;
int fx[4][2] = {1,0,-1,0,0,1,0,-1};

/*
template<typename T>
using maxHeap = priority_queue<T, vector<T>, less<T> >;
template<typename T>
using minHeap = priority_queue<T, vector<T>, greater<T> >;
*/

template<typename T>
inline T gcd(T a, T b){ return b==0 ? a : gcd(b,a%b); }
template<typename T>
inline T lowbit(T x){ return x&(-x); }
template<typename T>
inline bool mishu(T x){ return x>0?(x&(x-1))==0:false; }
inline char nc(){ static char buf[1000000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf,1,1000000,stdin),p1 == p2) ? EOF : *p1++; }
#define nc getchar
template<typename T>
inline int read(T& sum){ char ch = nc(); if(ch == EOF || ch == -1) return 0; int tf = 0; sum = 0; while((ch < '0' || ch > '9') && (ch != '-')) ch = nc(); tf = ((ch == '-') && (ch = nc())); while(ch >= '0' && ch <= '9') sum = sum*10 + (ch-48), ch = nc(); (tf) && (sum = -sum); return 1; }
template<typename T>
inline void print(T k){ int num = 0,ch[20]; if(k == 0){ putchar('0'); return ; } (k<0)&&(putchar('-'),k = -k); while(k>0) ch[++num] = k%10, k /= 10; while(num) putchar(ch[num--]+48); }
/*math*/
template<typename T1,typename T2, typename T3>
ll qmul(T1 a,T2 b,T3 p){ ll w = 0; while(b){ if(b&1) w = (w+a)%p; b>>=1; a = (a+a)%p; } return w; }
template<typename T1,typename T2, typename T3>
ll qpow(T1 a,T2 b,T3 p){ ll w = 1; while(b){ if(b&1) w = (qmul(w,a,p))%p; b>>=1; a = (qmul(a,a,p))%p;} return w; }
template<typename T>
ll exgcd(T a, T b, T& x, T& y){ if(b == 0){ x = 1, y = 0; return (ll)a; } ll r = exgcd(b,a%b,y,x); y -= a/b*x; return r;/*gcd*/ }

/* ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

int main(){
    ios_base::sync_with_stdio(false), cout.tie(0), cin.tie(0);
	int n,x;
	cin>>n>>x;
	int a[100005];
	a[0] = x;
	int minn = 1;
	GOE(i,1,n){
		cin>>a[i];
	}
	if(n == 1){
		cout << abs(x-a[1]) << endl;
		return 0;
	}
	sort(a,a+n+1);
	minn = a[1] - a[0];
	GOE(i,1,n){
		minn = gcd(minn,a[i]-a[i-1]);
	}

	cout << minn << endl;
    return 0;
}


Measured memory_bytes: 640