#include <bits/stdc++.h>
using namespace std;
const long long MAX = 3e5 + 600;
const long long mod = 1e9;
const long long N = 2e5 + 1;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long n, i, j, k, l, q;
void solve() {
  long long n, m, i, x, j, k, l;
  long long mex = 0;
  cin >> q >> x;
  multiset<long long> s;
  while (q--) {
    cin >> k;
    if (k == mex)
      mex++;
    else
      s.insert(k % x);
    while (1) {
      auto it = s.find(mex % x);
      if (it != s.end()) {
        s.erase(mex % x);
        mex++;
      }
      if (it == s.end()) break;
    }
    cout << mex << endl;
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
