#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using namespace std::chrono;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long q, x;
  cin >> q >> x;
  vector<long long> v(x);
  set<pair<long long, long long> > s;
  for (long long i = 0; i < x; i++) {
    s.insert(make_pair(v[i], i));
  }
  for (long long i = 0; i < q; i++) {
    long long val;
    cin >> val;
    val %= x;
    s.erase(make_pair(v[val], val));
    v[val]++;
    s.insert(make_pair(v[val], val));
    auto it = s.begin();
    long long res = (it->first) * x + it->second;
    cout << res << '\n';
  }
  return 0;
}
