import java.util.*;
import java.io.*;

public class Solution{
	public static void main (String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out=new PrintWriter(System.out);
		String[] temp=br.readLine().trim().split(" ");
		
		int q=Integer.parseInt(temp[0]);
		int x=Integer.parseInt(temp[1]);
		int[] freqArray=new int[x+5];
		int currMEX=0;
		while(q-->0){
		    int y=Integer.parseInt(br.readLine());
		    freqArray[y%x]++;
		    int j=currMEX;
		  
	      while(j<x && j<freqArray.length && freqArray[j%x]>=1)
	      {
	          j++;
	      }
		    while(j<freqArray.length && freqArray[j%x]>1)
		    {
		        freqArray[j%x]--;
		        j++;
		    }
		    currMEX=j;
		    out.println(currMEX);
		}
		
		out.flush();
		out.close();
	}
}