/*package whatever //do not write package name here */

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

public class GFG {
	public static void main (String[] args) throws IOException{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String s=br.readLine().trim();
		String ss[]=s.split("\\s+");
		int q=Integer.parseInt(ss[0]);
		int k=Integer.parseInt(ss[1]);
		int d[]=new int[k];
		
		int res=0,i=0;
		int max=Integer.MIN_VALUE;
		while(q--!=0){
			int n=Integer.parseInt(br.readLine().trim());
			d[n%k]++;
		    
		    while(d[res%k]!=0){
		        d[res%k]--;
		        res++;
		    }
		    System.out.println(res);
		}
		
	}
}