#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 n, x;
  cin >> n >> x;
  set<long long> st;
  long long mx = 0, a[x];
  while (n--) {
    long long in;
    cin >> in;
    in %= x;
    if (st.find(in) == st.end()) {
      a[in] = in;
    } else
      a[in] += x;
    st.insert(a[in]);
    while (st.find(mx) != st.end()) {
      mx++;
    }
    cout << mx << "\n";
  }
}
