import com.sun.security.jgss.GSSUtil;

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

final public class D {

    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder sb = new StringBuilder();
        String[] str = br.readLine().split(" ");
        int q = Integer.parseInt(str[0]), x = Integer.parseInt(str[1]);
        int currMex = 0;
        int[] remFreq = new int[x];
        while(q-->0){
            int z = Integer.parseInt(br.readLine())%x;
            remFreq[z]++;
            while(remFreq[currMex%x]!=0){
                remFreq[currMex%x]--;
                currMex++;
            }
            sb.append(currMex).append('\n');
        }
        System.out.println(sb);
    }
}