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
#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;
const int N=500005;
int n,k;
int tot;
struct tre{
	int ls,rs;
}t[N*21];
int rt[N];
int p,a[N],b[N];
struct edge{
	int r,next;
}e[N*21];
int rd[N],h[N],st;
void add(int x,int y){
	rd[y]++;
	e[++st].next=h[x];h[x]=st;e[st].r=y;
}
int tt,val[N];
void hins(int x){
	val[++tt]=x;int k;
	for(int i=tt;a[val[i]]<a[val[i>>1]]&&(i>>1);k=val[i],val[i]=val[i>>1],val[i>>1]=k,i>>=1);
}
void hdel(){
	val[1]=val[tt--];
	int k;
	for(int i=1;(i<<1)<=tt;){
		int mn=i<<1;
		if((i<<1|1)<=tt){
			if(a[val[i<<1|1]]<=a[val[mn]])mn=i<<1|1;
		}
		if(a[val[mn]]<a[val[i]])k=val[mn],val[mn]=val[i],val[i]=k,i=mn;
		else break;
	}
}
void connect(int l,int r,int now,int ml,int mr,int k){
	if(!now)return;
	if(ml==l&&mr==r){
		add(now,k);
		return;
	}
	int mid=l+r>>1;
	if(ml>mid)connect(mid+1,r,t[now].rs,ml,mr,k);
	else if(mr<=mid)connect(l,mid,t[now].ls,ml,mr,k);
	else connect(l,mid,t[now].ls,ml,mid,k),connect(mid+1,r,t[now].rs,mid+1,mr,k);
}
void ins(int l,int r,int &now,int las,int pos,int k){
	now=++tot;t[now]=t[las];
	add(k,now);
	if(l==r)return;
	int mid=l+r>>1;
	if(mid>=pos)ins(l,mid,t[now].ls,t[las].ls,pos,k);
	else ins(mid+1,r,t[now].rs,t[las].rs,pos,k);
}
int read(){
	int x=0;char ch=getchar();
	while(ch<'0'||ch>'9')ch=getchar();
	while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	return x;
}
int stpd[N*21],cnmd;
int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		p=read();
		a[p]=i;
	}
	tot=n;
	for(int i=1;i<=n;i++){
		connect(1,n,rt[i-1],a[i],min(a[i]+k-1,n),i);
		ins(1,n,rt[i],rt[i-1],a[i],i);
	}
	for(int i=1;i<=n;i++){
		if(!rd[i])hins(i);
	}
	for(int i=1;i<=n;i++){
		int x=val[1];
		while(x>n){
			hdel();
			for(int i=h[x];i;i=e[i].next){
				if(!(--rd[e[i].r])){
					if(e[i].r<=n)hins(e[i].r);
					else stpd[++cnmd]=e[i].r; 
				}
			}
			while(cnmd){
				x=stpd[cnmd--];
				for(int i=h[x];i;i=e[i].next){
					if(!(--rd[e[i].r])){
						if(e[i].r<=n)hins(e[i].r);
						else stpd[++cnmd]=e[i].r; 
					}
				}
			}
			x=val[1];
		}
		b[i]=a[x];
		hdel();
		for(int i=h[x];i;i=e[i].next){
			if(!(--rd[e[i].r])){
				if(e[i].r<=n)hins(e[i].r);
				else stpd[++cnmd]=e[i].r; 
			}
		}
		while(cnmd){
			x=stpd[cnmd--];
			for(int i=h[x];i;i=e[i].next){
				if(!(--rd[e[i].r])){
					if(e[i].r<=n)hins(e[i].r);
					else stpd[++cnmd]=e[i].r; 
				}
			}
		}
	}
	for(int i=1;i<=n;i++)a[b[i]]=i;
	for(int i=1;i<=n;i++)printf("%d\n",a[i]);
} 
