#include <bits/stdc++.h>
using namespace std;
long long n = 8e5 + 8;
vector<bool> isFilled(n + 1, false);
long long q, x;
long long mex = 0;
void solve() {
  cin >> q >> x;
  vector<long long> cnt(x);
  for (long long i = 0; i < q; ++i) {
    long long y;
    cin >> y;
    long long t = y % x;
    if (x * cnt[t] + t < n) isFilled[x * cnt[t] + t] = true;
    cnt[t]++;
    while (isFilled[mex]) mex++;
    cout << mex << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int T = 1;
  while (T--) solve();
  return 0;
}
