"use strict";
function Main(input) {
    let lines = input.split("\n");
    let cols = lines[0].split(/\s/).map((v) => v - 0);
    let N = cols[0], X = cols[1];
    let x = lines[1].split(/\s/).map((v) => v - 0);
    x.push(X);
    x.sort((a, b) => a - b);
    let y = [];
    for (let n = 1; n < x.length; n++) {
        y.push(Math.abs(x[n] - x[n - 1]));
    }
    console.log(Math.min(...y));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
