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