#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, x;
  cin >> t >> x;
  map<int, int> mp;
  int ans = 0;
  while (t--) {
    int n;
    cin >> n;
    int v;
    v = n % x;
    mp[v]++;
    while (1) {
      int rem = ans % x;
      int q = ans / x;
      if (mp[rem] > q)
        ans++;
      else
        break;
    }
    cout << ans << endl;
  }
  return 0;
}
