#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " ; ";
  err(++it, args...);
  cout << endl;
}
long long MEX = 0;
long long q, x;
map<long long, long long> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> q >> x;
  while (q--) {
    long long nnum;
    cin >> nnum;
    mp[nnum % x]++;
    long long keep = MEX / x + 1;
    while (mp[MEX % x] >= keep) {
      MEX++;
      keep = (MEX / x) + 1;
    }
    cout << MEX << endl;
  }
  return 0;
}
