#include <bits/stdc++.h>
using namespace std;
const long long int inf = 2e18;
const long long MOD = 998244353;
const int MAX = 1e6 + 10;
const long long int N = 1000000;
using namespace std;
void solve() {
  int n, x;
  cin >> n >> x;
  int mex = 0;
  vector<int> ctRem(x);
  for (int i = 0; i < n; ++i) {
    int cur;
    cin >> cur;
    ctRem[cur % x]++;
    while (ctRem[mex % x] >= mex / x + 1) mex++;
    cout << mex << endl;
  }
}
int main() {
  solve();
  return 0;
}
