import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] arr = br.readLine().split(" ");
int n = Integer.parseInt(arr[0]);
int s = Integer.parseInt(arr[1]);
String[] a = br.readLine().split(" ");
int[] distance = new int[n];
for(int i=0; i<n; i++) {
distance[i] = Math.abs(s-Integer.parseInt(a[i]));
}
if(n == 1) { System.out.println(distance[0]); return; }
int max = gcd(distance[0], distance[1]);
if(n <= 2) { System.out.println(max); return; }
for(int i=2; i<n; i++) {
int temp = max;
max = gcd(temp, distance[i]);
}
System.out.println(max);
}
public static int gcd(int n1, int n2) {
if(n2==0) { return n1; }
return gcd(n2, n1%n2);
}
}