#include <bits/stdc++.h>
using namespace std;
const int N = 1000010;
const int MOD = 1e9 + 7;
const int INF = 1e9;
int q, x;
int a[N];
int main() {
  scanf("%d%d", &q, &x);
  int j = 0;
  int ans = 0;
  while (q--) {
    int y;
    scanf("%d", &y);
    a[y % x]++;
    while (a[j] > 0) {
      ans++;
      a[j]--;
      j = (j + 1) % x;
    }
    printf("%d\n", ans);
  }
  return 0;
}
