using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Convert;
using static System.Math;
//using static System.Globalization.CultureInfo;
using System.Text;
class Program
{
    private static void chmin<T>(ref T num, T val) where T : IComparable<T>
        => num = num.CompareTo(val) == 1 ? val : num;
    private static void chmax<T>(ref T num, T val) where T : IComparable<T>
        => num = num.CompareTo(val) == -1 ? val : num;
    static void Main(string[] args)
    {
        var pr = new Program();
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        pr.Solve();
        Console.Out.Flush();
    }
    void Solve()
    {
        int num, x;
        Input.Make(out num, out x);
        var ar = Input.ar;
        var gcd = Abs(x-ar[0]);
        for (var i = 1; i < num; i++)
            gcd=Calculation.GCD(gcd, Abs(ar[i] - x));
        WriteLine(gcd);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static T[] create<T>(int n, Func<int, T> f)
        => Enumerable.Repeat(0, n).Select(f).ToArray();
    public static char[][] gred(int h)
        => create(h, _ => read.ToCharArray());
    public static int[] ar1D(int n)
        => create(n, _ => num);
    public static long[] arL1D(int n)
        => create(n, _ => numL);
    public static string[] strs(int n)
        => create(n, _ => read);
    public static int[][] ar2D(int n)
        => create(n, _ => ar);
    public static long[][] arL2D(int n)
        => create(n, _ => arL);
    public static List<T>[] edge<T>(int n)
        => create(n, _ => new List<T>());
    public static T GetValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static void Make<T1, T2>(out T1 v1, out T2 v2)
    {
        v1 = Next<T1>();
        v2 = Next<T2>();
    }
    public static void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        Make(out v1, out v2);
        v3 = Next<T3>();
    }
    public static void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4)
    {
        Make(out v1, out v2, out v3);
        v4 = Next<T4>();
    }
    public static void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5)
    {
        Make(out v1, out v2, out v3, out v4);
        v5 = Next<T5>();
    }
    public static void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6)
    {
        Make(out v1, out v2, out v3, out v4, out v5);
        v6 = Next<T6>();
    }
    private static Queue<string> sc;
    public static T Next<T>(){ sc = sc ?? new Queue<string>(); if (sc.Count == 0) foreach (var item in read.Split(' ')) sc.Enqueue(item);return GetValue<T>(sc.Dequeue()); }
    public static void Next<T>(ref T val) => val = Next<T>(); 
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}

public class Search
{
    public static int UpperBound<T>(IList<T> array,T value)
        where T : IComparable<T>
    {
        var low = 0;
        var high = array.Count;
        while (high > low)
        {
            var mid = (high + low) / 2;
            if (array[mid].CompareTo(value) == 1) high = mid;
            else low = mid + 1;
        }
        return low;
    }
    
    public static int LowerBound<T>(IList<T> array,T value)
        where T : IComparable<T>
    {
        var low = 0;
        var high = array.Count;
        while (high > low)
        {
            var mid = (high + low) / 2;
            if (array[mid].CompareTo(value) != -1) high = mid;
            else low = mid + 1;
        }
        return low;
    }

    public static bool Inside(int h, int w, int[] hw)
        => Inside(h, w, hw[0], hw[1]);
    public static bool Inside(int h, int w, int hh, int ww)
        => 0 <= h && h < hh && 0 <= w && w < ww;
    public static bool IsPrime(long num)
    {
        if (num % 2 == 0 || num == 1) return num == 2;
        for (var i = 3L; i * i <= num; i += 2)
            if (num % i == 0) return false;
        return true;
    }

}

public class Calculation
{
    public static int LCM(int num1, int num2)
        => num1 / GCD(num1, num2) * num2;

    public static long LCM(long num1, long num2)
        => num1 / GCD(num1, num2) * num2;

    public static int GCD(int num1, int num2)
        => num1 < num2 ? GCD(num2, num1) :
           num2 > 0 ? GCD(num2, num1 % num2) : num1;

    public static long GCD(long num1, long num2)
        => num1 < num2 ? GCD(num2, num1) :
           num2 > 0 ? GCD(num2, num1 % num2) : num1;

    public static long[][] E(int num)
    {
        var tm = new long[num][];
        for(var i = 0; i < num; i++) { tm[i] = new long[num];tm[i][i] = 1; }
        return tm;
    }

    public static T[][] trans<T>(T[][] ar)
    {
        var n = ar[0].Length;var m = ar.Length;
        var tm = new T[n][];
        for(var i = 0; i < n; i++)
        {
            tm[i] = new T[m];
            for (var j = 0; j < m; j++)
                tm[i][j] = ar[j][i];
        }
        return tm;
    }

    public static long dot(long[] ar1, long[] ar2)
    {
        var tm = 0L;
        for (var i = 0; i < ar1.Length; i++)
            tm = (tm + ar1[i] * ar2[i]) % Input.MOD;
        return tm;
    }

    public static long[] mul(long[][] ar, long[] ls)
        => ar.Select(a => dot(a, ls)).ToArray();
   
    public static long[][] mul(long[][] ar1,long[][] ar2)
    {
        var bt = trans(ar2);
        return ar1.Select(a => mul(bt, a)).ToArray();
    }

    public static long[][] pow(long[][] A,long n)
    {
        if (n == 0) return E(A.Length);
        var tm = pow(A, n / 2);
        if (n % 2 == 0) return mul(tm, tm);
        else return mul(mul(tm, tm), A);
    }

    public static List<int> PrimeList(long num)
    {
        if (num < 2) return new List<int>();
        var prime = new List<int> { 2 };
        var bo = new bool[num + 1];
        for (var i = 3; i <= num; i += 2)
            if (!bo[i])
            {
                prime.Add(i);
                for (var j = 3 * i; j <= num; j += 2 * i)
                    bo[j] = true;
            }
        return prime;
    }

    public static Dictionary<long,int> Factorize(long num)
    {
        var dic = new Dictionary<long, int>();
        for(var i = 2L; i * i <= num; i++)
        {
            var ct = 0;
            while (num % i == 0)
            {
                ct++;
                num /= i;
            }
            if (ct != 0) dic[i] = ct;
        }
        if (num != 1) dic[num] = 1;
        return dic;
    }
}                       


Measured memory_bytes: 21856