# ABC109C - Skip

def gcd(a, b):

    while a:

        a, b = b % a, a

    return b

        



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

lst = list(map(int, input().rstrip().split()))

d = abs(x - lst[0])

for i in range(n):

    dif = abs(x - lst[i])

    if dif % d == 0:

        continue

    d = gcd(d, dif)

print(d)
# ABC109C - Skip

def gcd(a: int, b: int) -> int:

    while a:

        a, b = b % a, a

    return b





def main():

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

    ans = abs(X - A[0])

    for i in A:

        dif = abs(X - i)

        if dif % ans:

            ans = gcd(ans, dif)

    print(ans)





if __name__ == "__main__":

    main()
# ABC109C - Skip
def gcd(a, b):
    while a:
        a, b = b % a, a
    return b


n, x = list(map(int, input().rstrip().split()))
lst = list(map(int, input().rstrip().split()))
d = abs(x - lst[0])
for i in range(n):
    dif = abs(x - lst[i])
    if dif % d == 0:
        continue
    d = gcd(d, dif)
print(d)

# ABC109C - Skip
def gcd(a: int, b: int) -> int:
    while a:
        a, b = b % a, a
    return b


def main():
    N, X, *A = list(map(int, open(0).read().split()))
    ans = abs(X - A[0])
    for i in A:
        dif = abs(X - i)
        if dif % ans:
            ans = gcd(ans, dif)
    print(ans)


if __name__ == "__main__":
    main()

-def gcd(a, b): +def gcd(a: int, b: int) -> int: -n, x = list(map(int, input().rstrip().split())) -lst = list(map(int, input().rstrip().split())) -d = abs(x - lst[0]) -for i in range(n): -    dif = abs(x - lst[i]) -    if dif % d == 0: -        continue -    d = gcd(d, dif) -print(d) +def main(): +    N, X, *A = list(map(int, open(0).read().split())) +    ans = abs(X - A[0]) +    for i in A: +        dif = abs(X - i) +        if dif % ans: +            ans = gcd(ans, dif) +    print(ans) + + +if __name__ == "__main__": +    main()