import scala.collection.mutable.ListBuffer

object Main extends App {
  import scala.io.StdIn.readLine

  val input = readLine().split(" ").map(_.toInt)
  val N = input(0)
  val X = input(1)

  val xArray = readLine().split(" ").map(_.toInt)
  var list = new ListBuffer[Int]
  list += X
  xArray.foreach(xi => {
    list += xi
  })
  list = list.sorted

  var min = 10000000000L
  var max = 0L
  for (i <- 0 to N - 1) {
    val diff = list(i + 1) - list(i)
    if (min > diff) min = diff
    if (max < diff) max = diff
  }

  if (max % min == 0) {
    print(min)
  } else {
    print(1)
  }
}
