#include <bits/stdc++.h>
using namespace std;
const int maxx = 5 + 4e5;
int MOD[maxx];
int main() {
  int q, x;
  cin >> q >> x;
  memset(MOD, 0, sizeof(MOD));
  int MEX = 0;
  while (q--) {
    int tmp;
    cin >> tmp;
    MOD[tmp % x]++;
    while (MOD[MEX % x]) {
      MOD[MEX % x]--;
      MEX++;
    }
    cout << MEX << endl;
  }
}
