"use strict";
const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");
let prev = parseInt(input[0].split(" ")[1]);
let ret = null;
for (const x of input[1].split(" ")) {
	const d = Math.abs(parseInt(x) - prev);
	if (ret = null) {
		ret = d;
	} else if (d % ret != 0) {
		ret = gcd(d, ret);
	}
}
console.log(ret);

function gcd(a, b) {
	if (b) return gcd(b, a % b);
	return a;
}
