#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long q, x, v, ans = 0, r, i, l;
  l = ans;
  cin >> q >> x;
  map<long long, long long> m;
  while (q--) {
    cin >> v;
    if (((v - ans) % x) == 0) {
      m[ans] = 1;
      ++ans;
      l = max(ans, l);
    } else {
      r = ceil((l * 1.0 - v) / x);
      r = v + x * r;
      while (m[r] != 0) {
        r = r + x;
      }
      m[r] = 1;
      l = max(l, r);
    }
    for (i = ans; 1; ++i) {
      if (m[i] == 0) {
        ans = i;
        break;
      }
    }
    l = max(l, ans);
    cout << ans << "\n";
  }
  return 0;
}
