import java.util.Scanner

import scala.annotation.tailrec

object Main extends App {
  val sc = new Scanner(System.in)
  val N, X = sc.nextInt
  val xs = Seq.fill(N)(Math.abs(sc.nextInt - X))

  @tailrec def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  println(xs.foldLeft(xs.head) { (acc, next) => gcd(acc, next) })
}
