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

public class Class2 {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine(), " ");
        int q = Integer.parseInt(st.nextToken());
        int x = Integer.parseInt(st.nextToken());
        int qr = q;
        int a[] = new int[q + 1];
        for (int i = 0; i < q + 1; i++) {
            a[i] = i;
        }
        int b[] = new int[q + 1];
        StringBuffer rs = new StringBuffer();
        int currm = 0;
        while (qr-- > 0) {
            int y = Integer.parseInt(br.readLine());
            y = y % x;
            if (a[y] < a.length&&a[y]>=0)
                b[a[y]] = 1;
            a[y] += x;
            if (b[currm] != 0) {
                for (int i = currm + 1; i <= q; i++) {
                    if (b[i] == 0) {
                        currm = i;
                        break;
                    }
                }
            }
            rs.append(currm + "\n");
        }
        System.out.println(rs);
    }
}