#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int q, x, k = 0;
  cin >> q >> x;
  int arr[x];
  memset(arr, 0, sizeof(arr));
  for (int i = 0; i < q; ++i) {
    int y;
    cin >> y;
    ++arr[y % x];
    while (k <= i && arr[k % x] > (k / x)) ++k;
    cout << k << endl;
  }
  return 0;
}
