#include <bits/stdc++.h>
using namespace std;
map<int, int> base;
int MEX = 0;
bool seen[400010];
int main() {
  int q, x, v;
  scanf("%d %d", &q, &x);
  while (q--) {
    scanf("%d", &v);
    int tot = v / x;
    int bs = v - tot * x;
    int val = bs + base[bs]++ * x;
    seen[val] = true;
    while (seen[MEX]) MEX++;
    printf("%d\n", MEX);
  }
  return 0;
}
