#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q, x;
  cin >> q >> x;
  int mex = 0;
  vector<bool> donmex(q, false);
  vector<int> store(x);
  for (int i = 0; i < x; i++) store[i] = i - x;
  int t = q;
  while (q--) {
    int ele;
    cin >> ele;
    int acrem = ele % x;
    int rem = (ele - mex) % x + mex;
    if (rem == mex) {
      donmex[mex] = true;
      store[acrem] = mex;
    } else {
      int mark;
      mark = store[acrem] + x;
      store[acrem] += x;
      if (mark < t) donmex[mark] = true;
    }
    while (donmex[mex]) mex++;
    cout << mex << '\n';
  }
  return 0;
}
