import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val Array(n, x) = input.nextLine().split(" ").map(_.toInt)
      val xs          = input.nextLine().split(" ").map(_.toInt)

      val diffs   = xs.map(xi => Math.abs(xi - x))
      val minDiff = diffs.min
      val divisors = minDiff :: 1.to(Math.sqrt(minDiff).toInt + 1).filter(i => minDiff % i == 0).reverse.toList

      divisors.find(d => diffs.forall(_ % d == 0)) match {
        case Some(v) => println(v)
      }
    }

  }

}
