#include <bits/stdc++.h>
using namespace std;
int x;
int ans(vector<int> a, int n) {
  int k = 0;
  for (int i = 0; i < n; ++i) {
    if (a[i % x] == 0) break;
    --a[i % x];
    ++k;
  }
  return k;
}
int main() {
  int q, temp;
  cin >> q >> x;
  vector<int> a;
  for (int i = 0; i < x; ++i) a.push_back(0);
  for (int i = 0; i < q; ++i) {
    cin >> temp;
    ++a[temp % x];
    cout << ans(a, i + 1) << 's' << endl;
  }
  return 0;
}
