import sys



def main():

  input = sys.stdin.readline

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

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

  C = list(set([abs(c - S) for c in C]))

  min_C = min(C)

  ans = 1

  for i in range(min_C, 1, -1):

    if min_C % i != 0:

      continue

    

    if all([c % i == 0 for c in C]):

      ans = i

      break

  print(ans)





if __name__ == '__main__':

  main()
import sys



def gcd(a, b):

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

  if b == 0:

    return a

  else:

    return gcd(b, a % b)





def main():

  input = sys.stdin.readline

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

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

  C = list(set([abs(c - S) for c in C]))

  

  ans = C[0]

  for i in range(1, len(C)):

    ans = gcd(ans, C[i])



  print(ans)





if __name__ == '__main__':

  main()

import sys


def main():
    input = sys.stdin.readline
    N, S = list(map(int, input().split()))
    C = list(map(int, input().split()))
    C = list(set([abs(c - S) for c in C]))
    min_C = min(C)
    ans = 1
    for i in range(min_C, 1, -1):
        if min_C % i != 0:
            continue
        if all([c % i == 0 for c in C]):
            ans = i
            break
    print(ans)


if __name__ == "__main__":
    main()

import sys


def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


def main():
    input = sys.stdin.readline
    N, S = list(map(int, input().split()))
    C = list(map(int, input().split()))
    C = list(set([abs(c - S) for c in C]))
    ans = C[0]
    for i in range(1, len(C)):
        ans = gcd(ans, C[i])
    print(ans)


if __name__ == "__main__":
    main()

+ + +def gcd(a, b): +    a, b = max(a, b), min(a, b) +    if b == 0: +        return a +    else: +        return gcd(b, a % b) -    min_C = min(C) -    ans = 1 -    for i in range(min_C, 1, -1): -        if min_C % i != 0: -            continue -        if all([c % i == 0 for c in C]): -            ans = i -            break +    ans = C[0] +    for i in range(1, len(C)): +        ans = gcd(ans, C[i])