#include <bits/stdc++.h>
using namespace std;
long long mod = 10e8 + 7;
long long i, j;
int main() {
  long long q, x;
  cin >> q >> x;
  long long y;
  map<long long, long long> m;
  set<pair<long long, long long> > s;
  set<pair<long long, long long> >::iterator it;
  for (i = 0; i < x; i++) {
    s.insert({0, i});
  }
  while (q--) {
    cin >> y;
    y %= x;
    s.erase({m[y], y});
    m[y]++;
    s.insert({m[y], y});
    it = s.begin();
    pair<long long, long long> p = *it;
    long long count = p.first;
    long long pos = p.second;
    cout << x * count + pos << endl;
  }
  return 0;
}
