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

import scala.annotation.tailrec

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)

      if (n <= 1) {
        output.println(Math.abs(xs.head - x))
      } else {
        val diffs = (x :: xs.toList).sorted
          .sliding(2)
          .map {
            case List(n, m) =>
              Math.abs(n - m)
          }
          .toSeq
        println(diffs.reduce(gcd))
      }
    }

    @tailrec
    final def gcd(m: Int, n: Int): Int = {
      val (x, y) = if (m > n) (m, n) else (n, m)
      if (y != 0) gcd(y, x % y)
      else x
    }

  }

}
