#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x;
  cin >> q >> x;
  vector<int> cnt(x, 0);
  int j = 0;
  while (q--) {
    int n;
    cin >> n;
    cnt[n % x]++;
    while (cnt[j % x] > 0) {
      cnt[j % x]--;
      j++;
    }
    cout << j << '\n';
  }
  return 0;
}
