#include <bits/stdc++.h>
using namespace std;
const int MAXN = 4e5 + 4;
int n, x;
int a[MAXN];
int main() {
  memset(a, 0, sizeof(a));
  scanf("%d%d", &n, &x);
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    int v;
    scanf("%d", &v);
    a[v % x]++;
    while (a[ans % x] > ans / x) ans++;
    printf("%d\n", ans);
  }
  return 0;
}
