import java.util.*;
import java.lang.Object;
import java.io.*;
public class D615
{
	public static void main(String [] args)   
	{
		MyScanner sc = new MyScanner();
	    PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
	    int q = sc.nextInt();
	    int x = sc.nextInt();
	    int cur = 0;
	    int [] rem = new int [x];
	    int ans = 0;
	    for (int i = 0; i < q; i++)
	    {
	    	int next = sc.nextInt();
	    	rem[next%x]++;
	    	while (rem[ans%x] != 0)
	    	{
	    		rem[ans%x]--;
	    		ans++;
	    	}
	    	out.println(ans);
	    }
	    out.close();
	}
	
	
	   //-----------MyScanner class for faster input----------
	   public static class MyScanner
	   {
	      BufferedReader br;
	      StringTokenizer st;
	 
	      public MyScanner() {
	         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;
	      }
	      
	      

	   }
	   

}
