#include <bits/stdc++.h>
int a[400001];
int main() {
  int q, x, i, j, n, m, num;
  memset(a, 0, sizeof(a));
  scanf("%d%d", &q, &x);
  j = 0;
  num = 0;
  for (i = 0; i < q; i++) {
    scanf("%d", &m);
    a[m % x]++;
    while (1) {
      if (a[j] > 0) {
        a[j]--;
        num++;
        j = (j + 1) % x;
      } else {
        break;
      }
    }
    printf("%d\n", num - 1);
  }
  return 0;
}
