import java.util.*;
import java.io.*;
import java.math.*;
public class kefa{
	static int mod = (int)1e9+7;
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	public static void main(String sp[])throws IOException{
		FastReader sc = new FastReader();
		int q =  sc.nextInt();
		int x = sc.nextInt();
		int arr[] = new int[x+1];
		int ans = 0;
		boolean g=false;
		TreeMap<Integer,Integer> hm = new TreeMap<>();
		while(q-->0){
			int n = sc.nextInt();
			int mod = n%x;
			arr[mod]+=1;
			hm.put(mod + (arr[mod]-1)*x, 0);
			while(g==false){
				if(!hm.containsKey(ans)){
					System.out.println(ans);
					break;
				}
				else ans++;
				if(ans>(int)1e5)
					break;
			}
		}
	}
	
	

	public static char[] swap(int a, int b, char arr[]){
		for(int i=a, j=b; i<=j;i++, j--){
			char hold = arr[i];
			arr[i] = arr[j];
			arr[j] = hold;
		}
		return arr;
	}


/*	public static class comp implements Comparator<pair>{
		public int compare(pair o1, pair o2){
			if(o1.l==o2.l)
				return o1.r-o2.r;
			return o1.l-o2.l;
		}
	}
	
	*/
	public static class pair{
		int val;
		String st = "";
	}
	

	
	public static long sum(long a, long d, long n){
		
		long total = ((n)*((2*a)+(n-1)*d))/2;
		return total;
	}
	
	public static class trie{
		char ch;
		HashMap<Character,trie> hm = new HashMap<>();
		int count;
		boolean isterminal;
	}
	
	
	public static int partition(int [] arr, int s, int e){
		
		int index=s;
		int pivot = arr[e];
		for(int i=s;i<=e-1;i++){
			if(arr[i]<=pivot){
				arr = swap(arr, index, i);
				index++;
			}
		}
		swap(arr,index,e);
		print(arr);
		return index;
	}
	
	public static int[] swap(int[] arr, int low, int high){
		int temp = arr[low];
		arr[low]=arr[high];
		arr[high]=temp;
		return arr;
	}
	
	
	public static long gcd(long a, long b){
		if(a==0)
			return b;
		
		return gcd(b%a,a);
	}
	
	public static void print(int[] arr){
		for(int i=0;i<arr.length;i++)
			System.out.print(arr[i]+" ");
		System.out.println();
	}
	
 
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
	
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
}