import java.util.*;
import java.io.*;
 
public class Main2 {
	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());}long nextLong(){return Long.parseLong(next());}double nextDouble(){return Double.parseDouble(next());}
        String nextLine(){String str = ""; try{str = br.readLine(); } catch (IOException e) {e.printStackTrace();} return str; } 
    }
	static int mod = (int)(1e9+7);
	static FastReader sc = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);
	public static void main (String[] args) {
		int t = 1;
    // 	t = sc.nextInt();
	    z : while(t-->0) {
	    	int q = sc.nextInt();
	    	int x = sc.nextInt();
	    	int mod[] = new int[x];
	    	int ans = 0;
	    	while(q-->0) {
	    		int y = sc.nextInt();
	    		mod[y%x]++;
	    		while(mod[ans%x]>ans/x) ans++;
	    		out.write(ans+"\n");
	    	}
		}
		out.close();
	}
}