#include <bits/stdc++.h>
using namespace std;
long long q, x, n, f[1000001], cnt[1000001], tmp;
set<long long> zero;
set<pair<long long, long long>> s;
int main() {
  cin >> q >> x;
  for (long long i = 0; i < x; i++) {
    zero.insert(i);
    s.insert({0, i});
  }
  while (q--) {
    cin >> n;
    n = n % x;
    s.erase({f[n], n});
    f[n]++;
    s.insert({f[n], n});
    zero.erase(n);
    if (zero.size())
      cout << (*zero.begin()) << "\n";
    else {
      long long num, freq;
      freq = (*(s.begin())).first;
      num = ((*(s.begin())).second);
      long long ans =
          x * (freq) + ((num != 0 and f[num - 1] - freq != 0) ? num : 0);
      cout << ans << "\n";
    }
  }
  return 0;
}
