#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 2e9;
const ll l = 1e8;
int main() {
  ll q, x, a;
  cin >> q >> x;
  set<pair<ll, ll>> st;
  vector<ll> frq(x);
  for (int i = 0; i < x; i++) st.insert({frq[i], i});
  while (q--) {
    cin >> a;
    a %= x;
    st.erase({frq[a], a});
    frq[a]++;
    st.insert({frq[a], a});
    ll ans = (*st.begin()).first * x + (*st.begin()).second;
    cout << ans << '\n';
  }
  return 0;
}
