import java.util.Scanner

fun main(args:Array<String>){
    val scanner=Scanner(System.`in`)

    val n=scanner.nextInt()
    val d=scanner.nextInt()
    var a= IntArray(n)
    var b=IntArray(n)

    for (i in 0 until n){
        a[i]=scanner.nextInt()
    }

    b[0]=d-a[0]
    if (b[0]<0) b[0]=-b[0]

    if (n>=2) {
        for (i in 1 until n) {
            b[i] = a[i] - a[i - 1]
            if (b[i] < 0) b[i] = -b[i]
        }
    }

    var sa=b[0]

    if (n>=2) {
        for (i in 1 until n) {
            sa = kou(sa, b[i])
        }
    }

   println(sa)
}

fun kou(n:Int,m:Int):Int{
    var t:Int
    var a=n
    var b=m
    if (m>n){
        a=m
        b=n
    }
    t=a%b
    while (t!=0){
        a=b
        b=t
        t=a%b
    }
    return b
}