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
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(x);i<=(y);++i)
int q[2001000],a[500010],p[500010];
inline void add(int l,int r,int o,int x,int y) {
	if(l==r){q[o]=y;return;}
	int mid=(l+r)/2;
	if(x<=mid)add(l,mid,2*o,x,y);
	else add(mid+1,r,2*o+1,x,y);
	q[o]=min(q[2*o],q[2*o+1]);
}
inline int query(int l,int r,int o,int x,int y){
	if(x<=l&&r<=y)return q[o];
	int mid=(l+r)/2,ret=1e9;
	if(x<=mid)ret=min(ret,query(l,mid,2*o,x,y));
	if(y>mid)ret=min(ret,query(mid+1,r,2*o+1,x,y));
	return ret;
}
struct Edge{
	int v,Next;
} G[1000010];
int head[500010],d[500010],tot;
inline void add(int u,int v){
	//cerr<<u<<" "<<v<<endl;
	G[++tot]=(Edge){v,head[u]};
	head[u]=tot;d[v]++;
}
int main() {
	int n,k;
	scanf("%d%d",&n,&k);
	rep(i,1,n)scanf("%d",&a[i]);
	rep(i,1,n)p[a[i]]=i;
	memset(head,-1,sizeof(head));
	rep(i,1,4*n)q[i]=1e9;
	for(int i=n;i>=1;--i){
		//cerr<<i<<endl;
		int wt=query(1,n,1,p[i],min(n,p[i]+k-1));
		if(wt!=1e9)add(p[i],p[wt]);
		wt=query(1,n,1,max(1,p[i]-k+1),p[i]);
		//if(wt!=1e9)cerr<<"pp "<<p[wt]<<endl;
		if(wt!=1e9)add(p[i],p[wt]);
		//cerr<<p[i]<<" " <<i<<endl;
		add(1,n,1,p[i],i);
		//cerr<<p[i]<<" " <<i<<endl;
	}//cerr<<233<<endl;
	priority_queue<int> Q;
	rep(i,1,n)if(!d[i]){
		Q.push(-i);
	}
	int tt=0;
	while(!Q.empty()){
		int x=-Q.top();Q.pop();
		p[++tt]=x;
		for(int i=head[x];i!=-1;i=G[i].Next){
			d[G[i].v]--;
			if(d[G[i].v]==0){
				Q.push(-G[i].v);
			}
		}
	}
	rep(i,1,n)a[p[i]]=i;
	rep(i,1,n)printf("%d\n",a[i]);
}