#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll inf = 2e9;
const ll l = 1e8;
int main() {
  map<int, bool> mp;
  ll mex = 0, q, x, a;
  cin >> q >> x;
  while (q--) {
    cin >> a;
    ll cur;
    if (a == mex)
      cur = a;
    else {
      if (a >= mex) {
        cur = a - mex;
        cur %= x;
        cur += mex;
      } else {
        cur = mex - a;
        cur = ceil(1.00 * cur / x);
        cur = cur * x + a;
      }
    }
    mp[cur] = 1;
    while (mp.find(mex) != mp.end() && mp[mex]) mex++;
    cout << mex << '\n';
  }
  return 0;
}
