#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  int 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++;
      if (mp[k % x] == 0) mp[k % x]++;
      while (mp[ans % x] > 1) {
        mp[ans % x]--;
        ans++;
      }
    } else {
      mp[k % x]++;
      while (mp[ans % x] > 1) {
        mp[ans % x]--;
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
