#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int main() {
  ios::sync_with_stdio(0);
  int t, x;
  cin >> t >> x;
  int n;
  int ans = 0;
  while (t--) {
    cin >> n;
    n = n % x;
    m[n]++;
    while (m[ans % x]) {
      m[ans % x]--;
      ans++;
    }
    cout << ans << endl;
  }
}
