#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
  return out << "(" << a.first << "," << a.second << ")";
}
template <class A>
ostream &operator<<(ostream &out, const vector<A> &a) {
  for (const A &it : a) out << it << " ";
  return out;
}
template <class A, class B>
istream &operator>>(istream &in, pair<A, B> &a) {
  return in >> a.first >> a.second;
}
template <class A>
istream &operator>>(istream &in, vector<A> &a) {
  for (A &i : a) in >> i;
  return in;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long q, x, in, mx = 0;
  cin >> q >> x;
  cin >> in;
  multiset<long long> st, oth;
  if (in == 0)
    mx = 1, st.insert(0);
  else
    oth.insert(in);
  cout << mx << "\n";
  q--;
  while (q--) {
    cin >> in;
    if (in == mx)
      st.insert(in), mx++;
    else {
      oth.insert(in);
      long long delta = 1;
      while (delta) {
        vector<long long> v;
        delta = 0;
        for (long long i : oth) {
          if (i + ((mx - i) / x) * x == mx) {
            v.push_back(i);
            st.insert(mx);
            mx++;
            delta = 1;
          }
        }
        for (long long i : v) oth.erase(oth.find(i));
      }
    }
    cout << mx << "\n";
  }
}
