#include <bits/stdc++.h>
using namespace std;
int arr[500005] = {0};
int main() {
  int q, x;
  scanf("%d %d", &q, &x);
  long long tmp;
  long long ans = 0;
  int cur = 0;
  while (q--) {
    scanf("%lld", &tmp);
    arr[tmp % x] += 1;
    int flag = 0;
    while (1) {
      if (arr[cur]) {
        arr[cur] -= 1;
        cur = (cur + 1) % x;
        ans += 1;
      } else {
        break;
      }
    }
    printf("%lld\n", ans);
  }
  return 0;
}
