#include <bits/stdc++.h>
using namespace std;
int q, cnt[400002], x;
set<pair<int, int> > st;
ifstream in("data.in");
int main() {
  cin >> q >> x;
  for (int i = 0; i < x; i++) st.insert({0, i});
  while (q--) {
    int t;
    cin >> t;
    t = t % x;
    st.erase({cnt[t], t});
    cnt[t] = cnt[t] + 1;
    st.insert({cnt[t], t});
    int minn = st.begin()->first;
    int pos = st.begin()->second;
    int ans = minn * x + pos;
    cout << ans << "\n";
  }
  return 0;
}
