#include <bits/stdc++.h>
using namespace std;
int plc[1000000], ck[1000000];
int main() {
  int t, r, x, i, y, n, k, ind = 0;
  cin >> n >> x;
  for (i = 0; i < x; i++) {
    ck[i] = i;
  }
  for (i = 0; i < n; i++) {
    cin >> k;
    k = k % x;
    y = ck[k];
    plc[y] = 1;
    if (y + x < 1000000) {
      ck[k] += x;
    }
    while (plc[ind]) ind++;
    cout << ind << endl;
  }
  return 0;
}
