#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int maxn = 4e5 + 9;
const int MOD = 998244353;
int qq[maxn];
int main() {
  int q, x;
  int ans = 0;
  while (scanf("%d%d", &q, &x) != EOF) {
    memset(qq, 0, sizeof(qq));
    while (q--) {
      int temp;
      scanf("%d", &temp);
      qq[temp % x]++;
      while (qq[ans % x]) {
        qq[ans % x]--;
        ans++;
      }
      printf("%d\n", ans);
    }
  }
}
