#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long int i, j, y, q, x, p;
  cin >> q >> x;
  map<long long int, long long int> pr;
  for (i = 0; i < q; i++) {
    cin >> y;
    if (i == 0) {
      pr[y] = 1;
      if (y > 0) {
        p = 0;
        cout << 0 << endl;
      } else {
        p = 1;
        cout << 1 << endl;
      }
    } else {
      if (abs(y - p) % x == 0) {
        pr[p] = 1;
        while (pr.find(p) != pr.end()) {
          pr[p] = 1;
          p++;
        }
        cout << p << endl;
      } else {
        if (y > p)
          y = (p + (abs(y - p)) % x);
        else
          y = p + (x - (abs(y - p) % x));
        pr[y] = 1;
        cout << p << endl;
      }
    }
  }
}
