#include <bits/stdc++.h>
using namespace std;
const long long MAX = 3e5 + 600;
const long long mod = 1e9;
const long long N = 4e5 + 1;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long mdl[N] = {0};
void solve() {
  long long n, q, m, i, x, j, k, l;
  long long mex = 0;
  cin >> q >> x;
  while (q--) {
    cin >> k;
    if (k % x == mex % x)
      mex++;
    else
      mdl[k % x]++;
    while (1) {
      if (mdl[mex % x]) {
        mdl[mex % x]--;
        mex++;
      } else
        break;
    }
    cout << mex << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
