N, X = list(map(int, input().split()))

P = [int(_) for _ in input().split()]



def gcd(a, b):

    a, b = max(a, b), min(a, b)

    while b:

        a, b = b, a%b

    return a



D = abs(P[0]-X)

for i in range(N):

    D = gcd(D, abs(P[i]-X))



print(D)
import sys



def gcd(a,b):

    a, b = max(a,b), min(a,b)

    while a % b > 0:

        a, b = b, a % b

    return b



def solve():

    input = sys.stdin.readline

    N, X = list(map(int, input().split()))

    A = [int(a) for a in input().split()]

    Ans = abs(A[0] - X)

    for a in A:

        Ans = gcd(Ans, abs(a - X))

    print(Ans)

    return 0



if __name__ == "__main__":

    solve()
N, X = list(map(int, input().split()))
P = [int(_) for _ in input().split()]


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


D = abs(P[0] - X)
for i in range(N):
    D = gcd(D, abs(P[i] - X))
print(D)

import sys


def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b


def solve():
    input = sys.stdin.readline
    N, X = list(map(int, input().split()))
    A = [int(a) for a in input().split()]
    Ans = abs(A[0] - X)
    for a in A:
        Ans = gcd(Ans, abs(a - X))
    print(Ans)
    return 0


if __name__ == "__main__":
    solve()

-N, X = list(map(int, input().split())) -P = [int(_) for _ in input().split()] +import sys -    while b: +    while a % b > 0: -    return a +    return b -D = abs(P[0] - X) -for i in range(N): -    D = gcd(D, abs(P[i] - X)) -print(D) +def solve(): +    input = sys.stdin.readline +    N, X = list(map(int, input().split())) +    A = [int(a) for a in input().split()] +    Ans = abs(A[0] - X) +    for a in A: +        Ans = gcd(Ans, abs(a - X)) +    print(Ans) +    return 0 + + +if __name__ == "__main__": +    solve()