#include <bits/stdc++.h>
using namespace std;
long long cnt[4 * 100010];
bool temp[4 * 100010];
int main() {
  long long n, x;
  cin >> n >> x;
  long long test = n, v;
  long long need = 0;
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &v);
    cnt[v % x]++;
    if (temp[v % x] && ((v % x) + x * (cnt[v % x] - 1)) < 4 * 100010)
      temp[(v % x) + x * (cnt[v % x] - 1)] = true;
    else
      temp[v % x] = true;
    while (temp[need]) need++;
    printf("%lld\n", need);
  }
}
