#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, x;
  cin >> n >> x;
  long long int p, pit;
  map<long long int, long long int> m1;
  long long int val;
  map<long long int, long long int>::iterator itr;
  bool bee;
  long long int to_find = 0;
  for (long long int k = 0; k < n; k++) {
    cin >> p;
    long long int soj = 0;
    bee = false;
    if (p == to_find) {
      to_find++;
    } else {
      itr = m1.find(p);
      if (itr == m1.end()) {
        m1.insert(make_pair(p, 1));
      } else {
        m1[p]++;
      }
    }
    for (long long int m = 0; m <= 1; m++) {
      for (itr = m1.begin(); itr != m1.end(); itr++) {
        if (soj > m1.size()) {
          bee = true;
          break;
        }
        val = itr->first;
        if (m1[val] > 0) {
          if (val < to_find) {
            pit = to_find - val;
            if (pit % x == 0) {
              m1[val]--;
              to_find++;
              soj = 0;
            } else {
              soj++;
            }
          }
          if (val > to_find) {
            pit = val - to_find;
            if (pit % x == 0) {
              m1[val]--;
              to_find++;
              soj = 0;
            } else {
              soj++;
            }
          }
        }
      }
      if (bee == true) {
        break;
      }
    }
    cout << to_find << endl;
  }
}
