#include <bits/stdc++.h>
using namespace std;
int n, q;
int ans;
int cnt[400005];
int main() {
  int x;
  scanf("%d %d", &q, &n);
  ans = 0;
  while (q--) {
    scanf("%d", &x);
    cnt[x % n]++;
    while (cnt[ans % n] > ans / n) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
