#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x;
  cin >> q >> x;
  vector<long long int> v(x);
  set<pair<int, int> > s;
  for (int i = 0; i < x; i++) {
    s.insert(make_pair(v[i], i));
  }
  for (int i = 0; i < q; i++) {
    int y;
    cin >> y;
    int temp = y % x;
    s.erase(make_pair(v[temp], temp));
    v[temp]++;
    s.insert(make_pair(v[temp], temp));
    auto it = s.begin();
    cout << (*it).first * x + (*it).second << endl;
  }
}
