#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int q, x, i, j, k;
  vector<int> v;
  map<int, int> extra;
  int last = -1;
  cin >> q >> x;
  while (q--) {
    int y;
    cin >> y;
    v.push_back(y);
    int z = y % x;
    if (z == 0 && last != -1) z = x;
    if (z * (1 + (last + 1) / x) == last + 1) {
      last++;
      while (extra.size() > 0) {
        if (extra[(last + 1) % x] > 0) {
          last++;
          extra[last % x]--;
          if (extra[last % x] == 0) extra.erase(last % x);
        } else
          break;
      }
    } else {
      extra[y % x]++;
    }
    while (1) {
      if (extra[(last + 1) % x] > 0) {
        last++;
        extra[last % x]--;
        if (extra[last % x] == 0) extra.erase(last % x);
      } else
        break;
    }
    cout << last + 1 << "\n";
  }
  return 0;
}
