import java.io.*;
public class CodeForces615D {
    public static void main (String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int x = Integer.valueOf(str[1]);
        int q = Integer.valueOf(str[0]);
        int[] count = new int[x];
        int currentMex= 0; // should this be changed
        for (int i= 0;i<q ;i++ ) {
           int temp = Integer.valueOf(br.readLine());
           Mex m = new Mex(temp,count,x,currentMex);
           m.findMex();
           count = m.count;
           currentMex = m.currentMex;
           System.out.println(currentMex);
        }
        
    }
}
class Mex{
    int x;
    int num; 
    int[] count;
    int currentMex;
    public Mex(int num, int[] count, int x, int currentMex){
        this.num = num; 
        this.count = count;
        this.x = x;
        this.currentMex = currentMex;
    }
    public void findMex(){
        if(num%x==currentMex%x){
            currentMex++ ;
            //do checks to see for stragglers
            boolean cleanUp = true;
            while(cleanUp){
                if(count[currentMex%x]>0){
                    count[currentMex%x]= count[currentMex%x]-1;
                    currentMex++;
                }else{
                    cleanUp = false;
                }
            }

        }else{
            count[num%x] = count[num%x] +1;
        }
        
    }
}
