#include <bits/stdc++.h>
using namespace std;
int q, x, cnt[1000000 + 5], lastMin, pos;
int main() {
  freopen("1.txt", "w", stdout);
  scanf("%d%d", &q, &x);
  for (int i = 1; i <= q; i++) {
    int num, minn = 1e9;
    scanf("%d", &num);
    cnt[num % x]++;
    if (cnt[num % x] <= lastMin + 1 || i == 1)
      for (int j = 0; j < x; j++) {
        if (minn > cnt[j]) minn = cnt[j], pos = j;
        if (minn == lastMin) break;
      }
    printf("%d\n", ((minn == 1e9) ? lastMin : minn) * x + pos);
    lastMin = (minn == 1e9) ? lastMin : minn;
  }
  return 0;
}
