#include <bits/stdc++.h>
using namespace std;
int q, x;
set<pair<int, int> > s;
vector<int> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> q >> x;
  for (int i = 0; i < x; ++i) {
    s.emplace(make_pair(0, i));
    v.push_back(0);
  }
  while (q--) {
    int tr;
    cin >> tr;
    tr %= x;
    auto it = s.find(make_pair(v[tr], tr));
    s.erase(it);
    s.emplace(make_pair(++v[tr], tr));
    it = s.begin();
    cout << (it->first * 1ll * x + it->second * 1ll) * 1ll << endl;
  }
  return 0;
}
