#include <bits/stdc++.h>
using namespace std;
long long int mp[400005] = {0};
int main() {
  set<long long int> s;
  long long int q, x;
  cin >> q >> x;
  long long int ans = 0;
  while (q > 0) {
    long long int k;
    cin >> k;
    mp[k % x]++;
    while (mp[ans % x] > 0) {
      mp[ans % x]--;
      ans++;
    }
    cout << ans << endl;
    q--;
  }
}
