import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class MEX {
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tokenizer = new StringTokenizer(f.readLine());
        int q = Integer.parseInt(tokenizer.nextToken());
        int x = Integer.parseInt(tokenizer.nextToken());
        boolean[] alreadyGot = new boolean[q];
        int[] lastFreeWithMod = new int[x];
        for (int i = 0; i < x; i++) {
            lastFreeWithMod[i] = i;
        }
        PrintWriter out = new PrintWriter(System.out);
        int currentMEX = 0;
        for (int i = 0; i < q; i++) {
            int modNum = Integer.parseInt(f.readLine()) % x;
            if (lastFreeWithMod[modNum] < q) {
                alreadyGot[lastFreeWithMod[modNum]] = true;
                lastFreeWithMod[modNum] += x;
            }

            while (currentMEX < q && alreadyGot[currentMEX]) {
                currentMEX++;
            }

            out.println(currentMEX);
        }

        out.close();
    }
}
