#include <bits/stdc++.h>
using namespace std;
int a[400400];
int main() {
  int n, x, ans = 0, need = 0, val;
  cin >> n >> x;
  for (int i = 1; i <= n; i++) {
    cin >> val;
    int c = val % x;
    a[c]++;
    while (a[need] != 0) {
      a[need]--;
      ans++;
      need == x - 1 ? need = 0 : need++;
    }
    cout << ans << "\n";
  }
  return 0;
}
