#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <class t>
using v = vector<t>;
using vi = v<int>;
using vc = v<char>;
int main() {
  int q, x;
  cin >> q >> x;
  vi buckets;
  buckets.resize(x);
  int mex = 0;
  for (int i = 0; i < q; ++i) {
    int y;
    cin >> y;
    ++buckets[y % x];
    while (buckets[mex % x] > (mex / x) && mex <= i) {
      ++mex;
    }
    cout << mex << endl;
  }
}
