#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void ZZ(const char* name, Arg1&& arg1) {
  cerr << name << " = " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void ZZ(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long q, x;
  cin >> q >> x;
  vector<long long> a(q + 5, 0), nxt(x, 0);
  iota(nxt.begin(), nxt.end(), 0);
  long long mex = 0;
  for (long long i = (0); i < (q); i++) {
    long long k;
    cin >> k;
    k %= x;
    a[nxt[k]] = 1;
    if (nxt[k] + x < q + 5) nxt[k] += x;
    while (a[mex]) ++mex;
    cout << mex << "\n";
  }
}
