using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static int n;

        static void Main(string[] args)
        {
            //[summary]C - Skip
            var lines = ReadLines<int>(1).ToList();
            n = lines[0][0];
            int x = lines[0][1];

            lines = ReadLines<int>(1).ToList();
            var positions = lines[0];

            //Listの先頭に出発地点の座標を挿入
            positions.Insert(0, x);

            //それぞれの目的地の間の距離を取得
            var distances = GetDistances(positions).ToList();

            int maxD = GetMaxD(distances);
            Console.WriteLine(maxD);
        }

        static IEnumerable<int> GetDistances(List<int> positions)
        {
            for(int i = 0; i < n; i++)
            {
                int startPos = positions[i];
                int destPos = positions[i + 1];

                yield return Math.Abs(destPos - startPos);
            }
        }

        static int GetMaxD(List<int> distances)
        {
            int a;
            int b;

            switch (distances.Count)
            {
                case 1:
                    return distances[0];
                case 2:
                    a = distances[0];
                    b = distances[1];

                    return GetMaxCommonDivisor(a, b);
                default:
                    a = distances[0];
                    b = distances[1];
                    b = GetMaxCommonDivisor(a, b);

                    for (int i = 2; i < distances.Count; i++)
                    {
                        a = distances[i];
                        b = GetMaxCommonDivisor(a, b);
                    }

                    return b;
            }
        }

        static int GetMaxCommonDivisor(int a, int b)
        {
            int num = a;
            int divisor = b;
            int mod;

            while (true)
            {
                mod = num % divisor;

                if (mod > 0)
                {
                    num = divisor;
                    divisor = mod;
                }
                else
                {
                    return divisor;
                }
            }
        }

        //static int GetMaxD(List<int> distances)
        //{
        //    int min = distances.Min();

        //    if (IsDivisible(min, distances))
        //    {
        //        return min;
        //    }
        //    else
        //    {
        //        int upper = min / 2 + 1;

        //        for(int i = 0; i < upper; i++)
        //        {
        //            int num = upper - i;

        //            if (IsDivisible(num, distances))
        //            {
        //                return num;
        //            }
        //        }
        //    }

        //    return 0;
        //}

        static bool IsDivisible(int num, List<int> distances)
        {
            foreach(var d in distances)
            {
                if (d % num != 0)
                {
                    return false;
                }
            }

            return true;
        }
                        
        static IEnumerable<List<T>> ReadLines<T>(int count = 0, char separator = ' ')
        {
            //[summary]コンソールの値を読み込んで、List<T>のコレクションを返却

            //読み込む行数が未指定のときは、1行目の値を"count"とみなす
            if (count == 0)
            {
                string line = Console.ReadLine().TrimEnd();
                count = int.Parse(line);
            }

            for (int i = 0; i < count; i++)
            {
                //コンソールを1行読み込み
                string line = Console.ReadLine().TrimEnd();

                //char型のときは1文字ずつに分割
                if (typeof(T) == typeof(char))
                {
                    var list = line.ToCharArray().ToList();
                    yield return (List<T>)(object)list;
                }
                else
                {
                    //読み込んだ値を"separator"で区切る
                    var list = line.Split(separator).ToList();

                    //int型のときは数値に変換
                    if (typeof(T) == typeof(int))
                    {
                        var numbers = list.ConvertAll(int.Parse);
                        yield return (List<T>)(object)numbers;
                    }
                    else
                    {
                        yield return (List<T>)(object)list;
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 19168