#include <bits/stdc++.h>
using ll = long long;
using namespace std;
const ll N = 2e5 + 5, mod = 1e9 + 7;
const ll inf = 1e18;
void solve() {
  ll q, x;
  cin >> q >> x;
  ll ans = 0;
  set<ll> s;
  vector<ll> a(x, -1);
  for (ll i = 0; i < q; i++) {
    ll y;
    cin >> y;
    y %= x;
    if (a[y] != -1) {
      a[y] += x;
    } else {
      a[y] = y;
    }
    s.insert(a[y]);
    while (s.find(ans) != s.end()) {
      ans++;
    }
    cout << ans << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1, p;
  for (p = 1; p <= t; p++) {
    solve();
  }
  return 0;
}
