def main():

    N, X = (int(i) for i in input().split())

    x = [abs(int(i) - X) for i in input().split()]

    from fractions import gcd

    for i in range(1,N):

        x[i] = gcd(x[i-1], x[i])



    print((x[-1]))



if __name__ == '__main__':

    main()


def gcd(x, y):

    if y == 0:

        return x

    while y != 0:

        x, y = y, x % y

    return x





def main():

    N, X = (int(i) for i in input().split())

    A = [int(i) for i in input().split()] + [X]

    A.sort()

    diff = [A[i+1] - A[i] for i in range(N)]

    ans = diff[0]

    for d in diff:

        ans = gcd(ans, d)

    print(ans)





if __name__ == '__main__':

    main()

def main():
    N, X = (int(i) for i in input().split())
    x = [abs(int(i) - X) for i in input().split()]
    from fractions import gcd

    for i in range(1, N):
        x[i] = gcd(x[i - 1], x[i])
    print((x[-1]))


if __name__ == "__main__":
    main()

def gcd(x, y):
    if y == 0:
        return x
    while y != 0:
        x, y = y, x % y
    return x


def main():
    N, X = (int(i) for i in input().split())
    A = [int(i) for i in input().split()] + [X]
    A.sort()
    diff = [A[i + 1] - A[i] for i in range(N)]
    ans = diff[0]
    for d in diff:
        ans = gcd(ans, d)
    print(ans)


if __name__ == "__main__":
    main()

+def gcd(x, y): +    if y == 0: +        return x +    while y != 0: +        x, y = y, x % y +    return x + + -    x = [abs(int(i) - X) for i in input().split()] -    from fractions import gcd - -    for i in range(1, N): -        x[i] = gcd(x[i - 1], x[i]) -    print((x[-1])) +    A = [int(i) for i in input().split()] + [X] +    A.sort() +    diff = [A[i + 1] - A[i] for i in range(N)] +    ans = diff[0] +    for d in diff: +        ans = gcd(ans, d) +    print(ans)