#include <bits/stdc++.h>
using namespace std;
using Long = long long;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  Long x;
  cin >> t >> x;
  set<int> mex;
  vector<set<Long> > modVals(x);
  for (int i = 0; i < x; ++i) {
    for (Long j = i; j <= 2ll * x; j += x) modVals[i].insert(j);
  }
  for (int i = 0; i < 100002; ++i) mex.insert(i);
  while (t--) {
    Long n;
    cin >> n;
    const int mod = n % x;
    const Long val = *begin(modVals[mod]);
    modVals[mod].erase(val);
    mex.erase(val);
    cout << *begin(mex) << "\n";
  }
  return 0;
}
