
object Main extends App {

  import scala.io.StdIn._
  import scala.math._
  val Array(n, x) = readLine.trim.split(' ').map(_.toLong)
  val positions = readLine.trim.split(' ').map{pos ⇒ abs(pos.toLong - x)}
  println(
    positions.foldLeft(positions(0)){(g, pos) ⇒ gcd(g, pos)}
  )

  def gcd(a: Long, b: Long): Long = {
    b match{
      case 0 ⇒ a
      case _ ⇒ gcd(b, a % b)
    }
  }
}
