#include <bits/stdc++.h>
using std::map;
map<int, int> tab;
int main(void) {
  int q, x;
  scanf("%d%d", &q, &x);
  int mex = 0, y, base = 0;
  for (int i = 0; i < q; ++i) {
    scanf("%d", &y);
    y %= x;
    ++tab[y];
    if (y == mex) {
      auto it = tab.find(y);
      while (it != tab.end()) {
        if (it->first == mex && it->second > base) {
          ++mex;
          if (mex == x) {
            mex = 0;
            ++base;
            it = tab.begin();
            continue;
          }
        } else
          break;
        ++it;
      }
    }
    printf("%d\n", mex + x * base);
  }
  return 0;
}
