#include <bits/stdc++.h>
using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
namespace Mods {
const int mod197 = 1e9 + 7;
const int mod199 = 1e9 + 9;
const int modfft = 998244353;
int MOD = mod197;
void Hplus(int& h, int b, int mod = MOD) {
  h += b;
  if (h > mod) h -= mod;
}
void Hminus(int& h, int b, int mod = MOD) {
  h -= b;
  if (h < 0) h += mod;
}
void Hmuliply(int& h, int b, int mod = MOD) { h = (1LL * h * b) % mod; }
ll binPow(ll a, ll n, int mod = MOD) {
  ll ans = 1;
  while (n > 1) {
    if (n & 1) ans = ans * a % mod;
    n >>= 1;
    a = a * a % mod;
  }
  if (n) ans = ans * a % mod;
  return ans;
}
}  // namespace Mods
namespace someUsefull {
template <typename T1, typename T2>
inline void checkMin(T1& a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void checkMax(T1& a, T2 b) {
  if (a < b) a = b;
}
}  // namespace someUsefull
using namespace std;
using namespace Mods;
using namespace someUsefull;
int _size = 1 << 20;
vector<bool> tree(_size << 1);
void upd(ll x) {
  if (x >= _size) return;
  x += _size;
  tree[x] = 1;
  x >>= 1;
  while (x) {
    tree[x] = tree[x << 1] & tree[x << 1 | 1];
    x >>= 1;
  }
}
int get() {
  int v = 1;
  while (v < _size) {
    v <<= 1;
    if (tree[v]) v |= 1;
  }
  return v - _size;
}
void solve() {
  ll q, x;
  cin >> q >> x;
  vector<int> mi(x);
  for (int i = 0; i < q; ++i) {
    ll t;
    cin >> t;
    t %= x;
    mi[t]++;
    t += x * (mi[t] - 1);
    upd(t);
    cout << get() << '\n';
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  t = 1;
  for (int i = 0; i < t; ++i) {
    solve();
  }
  return 0;
}
