#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long q, x;
  cin >> q >> x;
  long long cur = 0;
  unordered_map<long long, bool> m;
  while (q--) {
    long long y;
    cin >> y;
    if ((abs(y - cur)) % x == 0) {
      m[cur] = true;
      while (m[cur]) cur++;
      cout << cur << "\n";
    } else {
      long long tmp = cur;
      while ((abs(y - tmp)) % x) {
        tmp++;
      }
      m[tmp] = true;
      cout << cur << "\n";
    }
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
