object Main extends App {
  val X=readLine.split(" ")(1).toInt
  val xs=readLine.split(" ").map(_.toInt)
  def gcd(n:Int,m:Int):Int={
    val (g,l)=(List(n,m).max,List(n,m).min)
    if (l==0) g else gcd(l,g%l)
  }
  val xs2=xs.map(_ - X).map(_.abs)
  println(xs2.fold(xs2(0))(gcd(_,_)))
}
