#include <bits/stdc++.h>
using namespace std;
int main() {
  long long q, x, mex = 0;
  cin >> q >> x;
  map<long long, long long> m;
  while (q--) {
    long long y;
    cin >> y;
    m[y % x]++;
    bool flag = true;
    while (flag) {
      flag = false;
      if (m[mex % x] > 0) {
        m[mex % x]--;
        mex++;
        flag = true;
      }
    }
    cout << mex << endl;
  }
  return 0;
}
