#include <bits/stdc++.h>
long long mod = 1000000007;
void normalize(long long &a) { a = (a + mod) % mod; }
long long modmul(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a * b) % mod;
}
long long modadd(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a + b) % mod;
}
long long modsub(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  normalize(a);
  normalize(b);
  return (a - b + mod) % mod;
}
long long me(long long x, long long n) {
  x %= mod;
  if (n == 0) return 1;
  long long u = me(x, n / 2) % mod;
  u = (u * u) % mod;
  if (n % 2) u = (u * x) % mod;
  return u;
}
long long ipow(long long a, long long b) {
  long long c = 1;
  while (b--) c *= a;
  return c;
}
long long logb(long long a, long long b) {
  long long ans = 0;
  while (a >= b) {
    a /= b;
    ans++;
  }
  return ans;
}
using namespace std;
void solve() {
  long long q, x, mex = 0, a, M = 0;
  cin >> q >> x;
  vector<long long> v;
  set<long long> unuse;
  for (long long i = 0; i < q; i++) {
    cin >> a;
    v.push_back(a);
    if (a > mex) {
      a = a - x * ((a - M) / x) + x + x;
      while (a - x >= mex &&
             unuse.upper_bound(a - x) == unuse.lower_bound(a - x)) {
        a = a - x;
      }
    }
    if (a < mex) {
      a = a + x * ((mex - a) / x) - x - x;
      while (a + x < mex) {
        a = a + x;
      }
      while (unuse.upper_bound(a + x) != unuse.lower_bound(a + x)) {
        a = a + x;
      }
      a = a + x;
    }
    unuse.insert(a);
    if (a > M) M = a;
    auto it = unuse.begin();
    if (*it == mex) {
      while (*it == mex) {
        mex++;
        unuse.erase(it);
        it = unuse.begin();
      }
    }
    printf("%d", mex);
  }
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) solve();
  return 0;
}
