//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including Tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
#define ll long long
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vppll vector< pair<ll , pll> >
#define pb push_back
#define eb emplace_back
#define vll vector<ll>
#define mp make_pair
#define F first
#define S second
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define bc(x) __builtin_popcountll(x)
#define init(x) memset(x,-1,sizeof(x))
#define clr(x) memset(x,0,sizeof(x))
#define max_pq priority_queue<ll>
#define min_pq priority_queue<ll,vector<ll>,greater<ll>>
#define For(i,x,n) for(i=x; i<n; ++i)
#define inp(x) scanf("%lld",&x)
#define inp2(x,y) scanf("%lld %lld",&x, &y)
#define inp3(x,y,z) scanf("%lld %lld %lld",&x, &y, &z)
#define out(x) printf("%lld ",x)
#define br printf("\n")
#define T ll t; scanf("%lld",&t); while(t--)
#define MOD 1000000007
#define M   106
using namespace std;
using namespace __gnu_pbds;
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
ll modpow(ll a,ll b,ll m){ ll r=1; while(b>0) { if(b&1) r=(r*a)%m; a=(a*a)%m; b>>=1;} return r; }
ll inline add(ll a, ll b) { return (a%MOD+b%MOD)%MOD; }
ll inline sub(ll a, ll b) { return (a%MOD-b%MOD+MOD)%MOD; }
ll inline mul(ll a, ll b) { return (a%MOD*b%MOD)%MOD; }
ll inline divide(ll a, ll b) { return (a%MOD * modpow(b%MOD, MOD-2, MOD))%MOD; }
/*ll seive[M];
void create()
{
    clr(seive);
    for(ll i=M-1;i>=2;--i)
    {
        for(ll j=i;j<M;j+=i)
            seive[j]=i;
    }
}*/

/*bool seive1[M];
void create1()
{
    clr(seive1);
    seive1[1] = true;
    for(ll i=2;i<M;++i)
    {
        if(!seive1[i])
        {
            for(ll j=i<<1;j<M;j+=i)
                seive1[j]=true;
        }
    }
}*/
int main()
{
	ll n,x,p,i,z,hi,lo,mid;
	inp2(n,x);
	ll ans = 0;
	set<ll> st;
	while(n--) {
		inp(p);
		i = (p - ans) / x;
		hi = 1e6, lo = ceil(-(1.0*p)/(1.0*x));

		while(lo <= hi) {
			mid = (lo + hi) >> 1;
			if(st.find(p + x*mid) != st.end()) {
				i = mid+1;
				lo = mid+1;
			} else {
				hi = mid-1;
			}
		}
		// out(lo);out(hi);
		// out(i);getchar();
		z = p + x*i;
		// out(z);
		st.insert(z);
		while(st.find(ans) != st.end()) {
			++ans;
		}
		out(ans);
		br;
	}
	return 0;
}
