You are given a permutation P_1 ... P_N of the set {1, 2, ..., N}.

You can apply the following operation to this permutation, any number of times (possibly zero):

* Choose two indices i,j (1 ≦ i < j ≦ N), such that j - i ≧ K and |P_i - P_j| = 1. Then, swap the values of P_i and P_j.



Among all permutations that can be obtained by applying this operation to the given permutation, find the lexicographically smallest one.

Constraints

* 2≦N≦500,000
* 1≦K≦N-1
* P is a permutation of the set {1, 2, ..., N}.

Input

The input is given from Standard Input in the following format:


N K
P_1 P_2 ... P_N


Output

Print the lexicographically smallest permutation that can be obtained.

Examples

Input

4 2
4 2 3 1


Output

2
1
4
3


Input

5 1
5 4 3 2 1


Output

1
2
3
4
5


Input

8 3
4 5 7 8 3 1 2 6


Output

1
2
6
7
5
3
4
8
// wtf ... forgot to participate >_<
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cassert>
#include <queue>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

const int N=501000;
struct node {
	node *l,*r;
	int id,ind;
}pool[N*22],*cur=pool,*rt[N];
int h,t;
pair<int,node*> qu[N*22];
priority_queue<pair<int,node*> > Q;
int n,k,p[N],pos[N];
node* build(int l,int r) {
	node *p=cur++;
	p->id=1<<30;
	if (l!=r) {
		int md=(l+r)>>1;
		p->l=build(l,md);
		p->r=build(md+1,r);
		p->l->ind++; p->r->ind++;
	}
	return p;
}
void adde(node *p,node *q,int l,int r,int tl,int tr) {
	if (l==tl&&r==tr) {
		q->ind++;
	} else {
		int md=(l+r)>>1;
		if (tr<=md) adde(p,q->l,l,md,tl,tr);
		else if (tl>md) adde(p,q->r,md+1,r,tl,tr);
		else adde(p,q->l,l,md,tl,md),adde(p,q->r,md+1,r,md+1,tr);
	}
}
void push(pair<int,node*> p) {
	if (p.fi==1<<30) qu[t++]=p;
	else Q.push(p);
}
void dele(node *p,node *q,int l,int r,int tl,int tr) {
	if (l==tl&&r==tr) {
		q->ind--;
		if (q->ind==0) push(mp(q->id,q));
	} else {
		int md=(l+r)>>1;
		if (tr<=md) dele(p,q->l,l,md,tl,tr);
		else if (tl>md) dele(p,q->r,md+1,r,tl,tr);
		else dele(p,q->l,l,md,tl,md),dele(p,q->r,md+1,r,md+1,tr);
	}
}
node* insert(node *p,int l,int r,int x,node *v) {
	if (l==r) {
		return v;
	} else {
		node *q=cur++; q->id=1<<30;
		int md=(l+r)>>1;
		if (x<=md) q->l=insert(p->l,l,md,x,v),q->r=p->r;
		else q->r=insert(p->r,md+1,r,x,v),q->l=p->l;
		q->l->ind++; q->r->ind++;
		return q;
	}
}
int main() {
	scanf("%d%d",&n,&k); --k;
	rep(i,1,n+1) {
		scanf("%d",p+i);
//		p[i]=i;
		pos[p[i]]=i;
	}
	rt[0]=build(1,n);
	rep(i,1,n+1) {
		node *q=cur++;
		q->id=pos[i];
		adde(q,rt[i-1],1,n,max(1,pos[i]-k),min(n,pos[i]+k));
		rt[i]=insert(rt[i-1],1,n,pos[i],q);
	}
	for (node *p=pool;p!=cur;p++) if (p->ind==0) {
		push(mp(p->id,p));
//		printf("f1 %d %d\n",h,t);
	}
	VI ret;
//	puts("ff");
//	printf("ff %d\n",Q.empty());
	while (!Q.empty()||h!=t) {
		int id; node *q;
//		printf("%d %d\n",h,t);
		if (h!=t) {
			id=qu[h].fi; q=qu[h].se; ++h;
		} else {
			id=Q.top().fi; q=Q.top().se; Q.pop();
		}
//		printf("%d %d\n",id,q-pool);
		if (id!=1<<30) ret.pb(id);
		if (q->l&&q->r) {
			--q->l->ind; if (q->l->ind==0) push(mp(q->l->id,q->l));
			--q->r->ind; if (q->r->ind==0) push(mp(q->r->id,q->r));
		}
		if (id!=1<<30) {
			dele(q,rt[p[id]-1],1,n,max(1,id-k),min(n,id+k));
		}
	}
	reverse(all(ret));
	rep(i,0,n) p[ret[i]]=i+1;
	rep(i,1,n+1) printf("%d\n",p[i]);
}
