

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;



public class Main {
	
	public static void main(String[] args) {
		FastScanner scanner=new FastScanner();
		int q=scanner.nextInt(),k=scanner.nextInt();
		HashMap<Integer, Integer> map=new HashMap<>();
		int t=0;
	
		for(int i=0;i<q;i++) {
			int x=scanner.nextInt();
			
			map.put(x%k, map.getOrDefault(x%k, 0)+1);
			
			while(map.containsKey(t%k)&&map.get(t%k)>t/k) {
				t++;
				if(t>i+1) break;
			}
			
					System.out.println(t);

			
			
			
			
		}

		
		
		
			
			
			
					
			
		}

	
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		int[] readArray(int n) {
			int[] a=new int[n];
			for (int i=0; i<n; i++) a[i]=nextInt();
			return a;
		}
		long nextLong() {
			return Long.parseLong(next());
		}
}

}
