#include <bits/stdc++.h>
using namespace std;
int p[400000] = {0};
set<pair<int, int>> s;
int main() {
  int q, x;
  cin >> q >> x;
  for (int i = 0; i < x; ++i) s.insert({0, i});
  for (int i = 0; i < q; ++i) {
    int a;
    cin >> a;
    s.erase({p[a % x], a % x});
    ++p[a % x];
    s.insert({p[a % x], a % x});
    auto r = *s.begin();
    cout << r.first * x + r.second << "\n";
  }
}
