import std.stdio;
import std.algorithm;
import std.conv;
import std.numeric;
import std.string;

void main() {
    auto input = readln.split.to!(ulong[]);
    auto n = input[0];
    auto x = input[1];
    auto xi = readln.split.to!(ulong[]);
    xi ~= x;
    xi.sort();
    ulong[] d = [];
    foreach(i; 0..n)
        d ~= xi[i + 1] - xi[i];
    auto ans = d[0];
    foreach(i; 1..n)
        ans = gcd(ans, d[i]);
    ans.writeln;
}
