import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int read() { return readln.chomp.to!int; }
int[] reads() { return readln.split.to!(int[]); }

int gcd(int a, int b) {
    return !b ? a : gcd(b, a%b);
}

void main() {
    int n, x; readf("%d %d\n",&n,&x);
    int[] xs = (reads ~ x)
        .sort()
        .array;

    int[] difs;
    foreach (i; 0..n)
        difs ~= xs[i + 1] - xs[i];
    difs ~= difs.front;
    writeln(difs.fold!(gcd));
}