#include <bits/stdc++.h>
using namespace std;
int main() {
  int q, x;
  cin >> q;
  cin >> x;
  int arr[400000];
  int v;
  int MEX = 0;
  int rM = 0;
  for (int i = 0; i < q; i++) {
    cin >> v;
    v %= x;
    arr[v] += 1;
    while (arr[rM] > 0) {
      arr[rM] = (arr[rM] - 1 < 0) ? 0 : arr[rM] - 1;
      ;
      MEX += 1;
      rM = (rM + 1) % x;
    }
    if (arr[rM] < 0) {
      cout << arr[rM] << "d" << rM << "c";
    }
    cout << MEX << "\n";
  }
  return 0;
}
