#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, n, t, q, x, k;
  cin >> q >> x;
  unordered_set<long long> myset;
  unordered_set<long long>::iterator it;
  long long min = 0;
  while (q--) {
    cin >> n;
    if (min >= n) {
      it = myset.find(n);
      while (it != myset.end()) {
        n += x;
        it = myset.find(n);
      }
      myset.insert(n);
    } else {
      k = (n - min) / x;
      n -= (k * x);
      it = myset.find(n);
      while (it != myset.end()) {
        k--;
        n -= (k * x);
        it = myset.find(n);
      }
      myset.insert(n);
    }
    while (1) {
      it = myset.find(min);
      if (it == myset.end()) {
        cout << min << '\n';
        break;
      } else
        min++;
    }
  }
  return 0;
}
