#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q, v;
  cin >> q >> v;
  int mex = 0;
  set<int> se;
  for (int i = 0; i < q; i++) {
    int x;
    cin >> x;
    if (x >= mex) {
      int a = (x - mex) / v;
      int j = x - a * v;
      se.insert(j);
    } else if (se.find(x) == se.end()) {
      se.insert(x);
    } else if (x < mex) {
      double a = (mex - x) / (double)v;
      int b = ceil(a);
      int ans = x + b * v;
      se.insert(x + b * v);
    }
    if (se.find(mex) != se.end()) {
      int prev = mex;
      int k = mex + 1;
      while (se.find(k) != se.end()) {
        auto m = se.lower_bound(k + 1);
        if (m == se.end()) {
          k++;
          break;
        }
        k = *m;
      }
      mex = k;
    }
    cout << mex << "\n";
  }
}
