#include <bits/stdc++.h>
using namespace std;
map<long long, long long> m;
bool bs(long long mid) {
  if (m[mid])
    return false;
  else
    return true;
}
int main() {
  long long q, x, v, ans = 0, r, i, l, lo, mid, hig, z, p1, p2;
  cin >> q >> x;
  while (q--) {
    cin >> v;
    if (((v - ans) % x) == 0) {
      m[ans] = 1;
      ++ans;
    } else {
      lo = ans;
      hig = 1e10;
      p1 = ans;
      p2 = hig;
      while (lo < hig) {
        mid = (lo + hig) / 2;
        r = floor((mid * 1.0 - v) / x);
        mid = v + x * r;
        if (mid < lo) {
          mid = mid + x;
          if (mid > hig) break;
        }
        if (bool(mid)) {
          hig = mid;
        } else {
          lo = mid + 1;
        }
        if ((lo == p1) && (hig == p2))
          break;
        else {
          p1 = lo, p2 = hig;
        }
      }
      m[hig] = 1;
    }
    for (i = ans; 1; ++i) {
      if (m[i] == 0) {
        ans = i;
        break;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
