def gcd(a, b):

    while b:

        a, b = b, a % b

    return a





def main():

    N, X, *xn = list(map(int, open(0).read().split()))

    ans = None

    for x in xn:

        div = abs(X - x)

        if ans is None:

            ans = div

        elif abs(X - x) % ans:

            ans = gcd(ans, abs(X - x))

    print(ans)

    return





main()

def gcd(a, b):

    while b:

        a, b = b, a % b

    return a





def main():

    N, X, *xn = list(map(int, open(0).read().split()))

    ans = None

    for x in xn:

        div = abs(X - x)

        if ans is None:

            ans = div

        elif div % ans:

            ans = gcd(ans, div)

    print(ans)

    return





main()

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    N, X, *xn = list(map(int, open(0).read().split()))
    ans = None
    for x in xn:
        div = abs(X - x)
        if ans is None:
            ans = div
        elif abs(X - x) % ans:
            ans = gcd(ans, abs(X - x))
    print(ans)
    return


main()

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def main():
    N, X, *xn = list(map(int, open(0).read().split()))
    ans = None
    for x in xn:
        div = abs(X - x)
        if ans is None:
            ans = div
        elif div % ans:
            ans = gcd(ans, div)
    print(ans)
    return


main()

-        elif abs(X - x) % ans: -            ans = gcd(ans, abs(X - x)) +        elif div % ans: +            ans = gcd(ans, div)