def gcd(a, b):

    while a > 0:

        if a < b:

            a, b = b, a

        a = a % b

    return b



n, x = list(map(int, input().split()))

town = list(map(int, input().split()))



distance = (abs(x-y) for y in town)

res = next(distance)

for d in distance:

    res = gcd(res, d)



print(res)

import sys

input = sys.stdin.readline



def gcd(a, b):

    while a > 0:

        if a < b:

            a, b = b, a

        a = a % b

    return b



def main():

    n, x = list(map(int, input().split()))

    town = list(map(int, input().split()))



    distance = (abs(x-y) for y in town)

    res = next(distance)

    for d in distance:

        res = gcd(res, d)



    print(res)



if __name__ == "__main__":

    main()
def gcd(a, b):
    while a > 0:
        if a < b:
            a, b = b, a
        a = a % b
    return b


n, x = list(map(int, input().split()))
town = list(map(int, input().split()))
distance = (abs(x - y) for y in town)
res = next(distance)
for d in distance:
    res = gcd(res, d)
print(res)

import sys

input = sys.stdin.readline


def gcd(a, b):
    while a > 0:
        if a < b:
            a, b = b, a
        a = a % b
    return b


def main():
    n, x = list(map(int, input().split()))
    town = list(map(int, input().split()))
    distance = (abs(x - y) for y in town)
    res = next(distance)
    for d in distance:
        res = gcd(res, d)
    print(res)


if __name__ == "__main__":
    main()

+import sys + +input = sys.stdin.readline + + -n, x = list(map(int, input().split())) -town = list(map(int, input().split())) -distance = (abs(x - y) for y in town) -res = next(distance) -for d in distance: -    res = gcd(res, d) -print(res) +def main(): +    n, x = list(map(int, input().split())) +    town = list(map(int, input().split())) +    distance = (abs(x - y) for y in town) +    res = next(distance) +    for d in distance: +        res = gcd(res, d) +    print(res) + + +if __name__ == "__main__": +    main()