#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int q, x;
  cin >> q >> x;
  vector<int> queries(q);
  for (int& query : queries) cin >> query;
  int mex = 0;
  unordered_map<int, int> extra;
  for (int v : queries) {
    if (v % x == (mex % x)) {
      ++mex;
      while (extra[mex % x]) {
        --extra[mex % x];
        ++mex;
      }
    } else {
      ++extra[v % x];
    }
    cout << mex << endl;
  }
}
