#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long int q, x, y, i, j, l, u, m, v;
  cin >> q >> x;
  set<long long int> st;
  for (i = 0; i <= q; i++) st.insert(i);
  long long int next[x];
  for (i = 0; i < x; i++) next[i] = i;
  for (i = 0; i < q; i++) {
    cin >> y;
    y %= x;
    while (next[y] <= q && st.find(next[y]) == st.end()) next[y] += x;
    st.erase(next[y]);
    next[y] += x;
    cout << *st.begin() << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  int test = 1;
  while (test--) solve();
}
