import java.util.*;
import java.io.*;
public class Task{
public static void main(String[] args) throws FileNotFoundException, IOException{
       Scanner s=new Scanner(System.in);
       BufferedWriter out=new BufferedWriter(new OutputStreamWriter(System.out));
       	StringBuilder sb=new StringBuilder();
       	int q=s.nextInt(),x=s.nextInt();
       	int[] dp=new int[x];int i=1,pre=0;
       	while(q--!=0){
       		int cc=s.nextInt()%x;
       		dp[cc]++;
       		int tmp=pre;
       		for(int j=tmp;j<i;j++){
       			if(tmp!=j){break;}
       			if(dp[tmp%x]>0){dp[tmp%x]--;tmp++;}       			
       		}
       		pre=tmp;i++;
       			out.write(tmp+"\n");
       	}
          out.flush();
       	}
       }
        
  
 