#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  unsigned long long t, n, i, j, k, l, x, ans = 0;
  cin >> n;
  cin >> x;
  unordered_map<int, int> mp;
  for (i = 0; i < n; i++) {
    cin >> k;
    if (ans % x == k % x) {
      ans++;
      while (mp[ans % x]) {
        mp[ans % x]--;
        ans++;
      }
    } else {
      mp[k % x]++;
      while (mp[ans % x]) {
        mp[ans % x]--;
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
