#include <bits/stdc++.h>
using namespace std;
using namespace std;
unsigned long long z = 1000000007;
unsigned long long fe[400005] = {0};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  unsigned long long q, x;
  cin >> q >> x;
  unsigned long long mex = 0;
  unsigned long long y;
  while (q--) {
    cin >> y;
    fe[y % x]++;
    while (fe[mex % x]) {
      fe[mex % x]--;
      mex++;
    }
    cout << mex << endl;
  }
}
