#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  long long t = 1;
  while (t--) {
    long long q, x, y, mex = 0;
    cin >> q >> x;
    set<long long> s;
    map<long long, long long> mp;
    for (long long i = 0; i <= q + 5; i++) {
      s.insert(i);
    }
    for (long long i = 0; i < q; i++) {
      cin >> y;
      y = y % x;
      if (s.find(y) != s.end()) {
        s.erase(y);
        if (!mp[y])
          mp[y] += y + x;
        else
          mp[y] += x;
        cout << *s.begin() << "\n";
      } else {
        s.erase(mp[y]);
        if (!mp[y])
          mp[y] += y + x;
        else
          mp[y] += x;
        cout << *s.begin() << "\n";
      }
    }
  }
  return 0;
}
