#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x;
  cin >> q >> x;
  map<int, int> m;
  map<int, int> m1;
  int r = 0, M = -1;
  for (int i = 0; i < q; i++) {
    int n;
    cin >> n;
    if (r == n)
      r += 1;
    else {
      if (n < r) {
        int q = (r - n) / x;
        if ((r - n) % x == 0)
          r += 1;
        else {
          int t = n + (q + 1) * x;
          if (m[t] == 1) {
            t = n + (q + m1[n]) * x;
            m1[n] += 1;
          } else
            m1[n] = 2;
          m[t] = 1;
        }
      } else {
        int q = (n - r) / x;
        if ((r - n) % x == 0)
          r += 1;
        else {
          int t = n - q * x;
          if (m[t] == 1) {
            t = n - q * x + m1[n] * x;
            m1[n] += 1;
          } else
            m1[n] = 1;
          m[t] = 1;
        }
      }
    }
    while (m.find(r) != m.end()) {
      r += 1;
    }
    cout << r << endl;
  }
}
