#include <bits/stdc++.h>
using namespace std;
const int maxn = 4e5 + 9;
int book[maxn];
int main() {
  int q, x;
  scanf("%d%d", &q, &x);
  int now = 0;
  int hu = 0, ans = 0;
  while (q--) {
    int y;
    scanf("%d", &y);
    int h = y % x;
    book[h]++;
    if (h == now) {
      ans++;
      now++;
      while (book[now] > hu && now < x) {
        ans++;
        now++;
      }
      if (now == x) {
        now = 0;
        hu++;
      }
      while (book[now] > hu && now < x) {
        now++;
        ans++;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
