For this Question: Given N cities in a line and your initial position, you want to visit all the cities at least once. You can go to one coordinate P to P+D or P-D where D is the number of steps which you choose initially. Your task is to find the maximum value of D such that you can visit all the cities at least once.The first line of input contains two integers N and X(initial position). The second line of input contains N space separated integers representing the location of cities.

Constraints:-
1 <= N <= 100000
1 <= City[] <= 100000000Print the maximum value of D such that you can visit all the cities.Sample Input:-
3 3
1 7 11

Sample Output:-
2

Sample Input:-
3 81
33 105 57

Sample Output:-
24, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
		static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		String next(){
			while (st == null || !st.hasMoreElements()){
				try{
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException  e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
	}











	static int gcd(int a, int b)
    {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }


	public static void main (String[] args) {
			FastReader inp = new FastReader();
			int n = inp.nextInt();
			int x = inp.nextInt();
			int[] arr = new int[n];
			int result =0;
			for (int i = 0 ; i < n ; i++){
				arr[i] = inp.nextInt();
				arr[i] = Math.abs(arr[i] - x );
				if (i ==0 ){
					result = arr[i];
				}else{
					result = gcd(result,arr[i]);
				}
			}
			System.out.print(result);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?