import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int x = in.nextInt();
            int[] free = new int[x];
            int target = 0;
            StringBuilder stringBuilder = new StringBuilder();
            for (int i0 = 0; i0 < n; i0++) {
                int val = in.nextInt() % x;
                free[val]++;

                //now try to increase target
                while (true) {
                    int req = target % x;
                    if (free[req] == 0)
                        break;

                    target++;
                    free[req]--;
                }
                stringBuilder.append(target + "\n");
            }
            out.println(stringBuilder.toString());
        }

    }
}

