object Main {
    def gcd (x : Int, y : Int) : Int = {
        if (y > x) gcd (y, x)
        else if (x % y == 0) y else gcd(y, x % y)
    }
    def main(args: Array[String]) = {
        val sc = new java.util.Scanner(System.in)
        val n, x = sc.nextInt
        val xs = List.fill(n)(sc.nextInt)
        
        val ds : List[Int] = xs.map(y => math.abs(x - y))
        val ans = ds.fold(ds(0))(gcd(_, _))
        println(ans)
    }
}