#include <bits/stdc++.h>
using namespace std;
long long fac[500005];
map<long long, long long> prime;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = ((res % p) * (x % p)) % p;
    y = y >> 1;
    x = ((x % p) * (x % p)) % p;
  }
  return res;
}
long long modInverse(long long n, long long p) { return power(n, p - 2, p); }
long long nCrModPFermat(long long n, long long r, long long p) {
  if (r == 0) return 1;
  if (r == n) return 1;
  return (((fac[n] % p) * (modInverse(fac[r], p) % p)) % p *
          (modInverse(fac[n - r], p) % p)) %
         p;
}
void sieve(long long n) {
  for (long long p = 2; p * p <= n; p++) {
    if (!prime[p]) {
      for (long long i = p * p; i <= n; i += p) prime[i] = 1;
    }
  }
}
void fun() {
  long long q, x;
  long long ans = 0;
  cin >> q >> x;
  map<long long, long long> mp;
  while (q--) {
    long long y;
    cin >> y;
    mp[y % x]++;
    while (mp[ans % x] > 0) {
      mp[ans % x]--;
      ans++;
    }
    cout << ans << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tc;
  tc = 1;
  while (tc--) {
    fun();
  }
}
