import java.util.Scanner

object Main {
  val sc = new Scanner(System.in)
  def main(args: Array[String]): Unit={
    val n  = sc.nextInt
    val y  = sc.nextInt
    val ix = Vector.fill(n)(sc.nextInt)

    val xl  = ix.map(x => Math.abs( x - y))

    val res = xl.foldLeft(0)(gcd(_,_))

    println(res)
  }
  
  def gcd(a: Int, b: Int): Int ={
    (a,b) match{
      case (x,y) if y == 0 => x
      case (x,y) if x < y  => gcd(y, x)
      case (x,y)           => gcd(y, x % y)
    }
  }}