#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
typedef long long ll;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
int a[N];
int main()
{
    int n, x;
    scanf("%d%d", &n, &x);
    for (int i = 0; i < n; i++)
        scanf("%d", a + i), a[i] = abs(a[i] - x);
    int g = *a;
    for (int i = 0; i < n; i++)
        g = gcd(g, a[i]);
    printf("%d", g);
    return 0;
}