#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, tt, t;
  cin >> n >> x;
  int mx = 0;
  map<int, int> mp;
  for (int i = 0; i < n; ++i) {
    cin >> tt;
    if (tt == mx) {
      mp[tt]++;
      mx++;
      while (mp[mx] > 0) mx++;
    } else if (tt < mx) {
      if ((mx - tt) % x == 0) {
        tt = mx;
      } else {
        tt = mx - (mx - tt) % x + x;
      }
      mp[tt]++;
      while (mp[mx] > 0) {
        mx++;
      }
    } else {
      if ((tt - mx) % x == 0) {
        tt = mx;
      } else {
        tt = mx + (tt - mx) % x;
      }
      mp[tt]++;
      while (mp[mx] > 0) {
        mx++;
      }
    }
    cout << mx << endl;
  }
  return 0;
}
