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;
const int N=5e5+5,inf=1e9+5;
int n,K;
int head[N],ce,deg[N];
struct edge{int to,nxt;} e[N<<1];
int p[N],a[N],ord[N],ans[N],cnt;
struct Segtree{int l,r,minx;} tr[N<<2];
void Build(int l,int r,int k)
{
	tr[k].l=l,tr[k].r=r,tr[k].minx=inf;
	if(l==r) return;
	int mid=(l+r)>>1;
	Build(l,mid,k<<1); Build(mid+1,r,k<<1|1);
}
void Insert(int x,int k)
{
	if(tr[k].l==tr[k].r)
	{
		tr[k].minx=p[x];
		return;
	}
	int mid=(tr[k].l+tr[k].r)>>1;
	if(mid>=x) Insert(x,k<<1);
	else Insert(x,k<<1|1);
	tr[k].minx=min(tr[k<<1].minx,tr[k<<1|1].minx);
}
int Query(int l,int r,int k)
{
	if(l>r) return inf;
	if(l<=tr[k].l && tr[k].r<=r)
		return tr[k].minx;
	int ret=inf,mid=(tr[k].l+tr[k].r)>>1;
	if(l<=mid) ret=min(ret,Query(l,r,k<<1));
	if(r>mid) ret=min(ret,Query(l,r,k<<1|1));
	return ret;
}
void topsort()
{
	priority_queue<pair<int,int> > Q;
	for(int i=1;i<=n;++i) if(!deg[i]) Q.push(make_pair(-a[i],i));
	while(!Q.empty())
	{
		int u=Q.top().second; Q.pop();
		ord[++cnt]=u;
		for(int i=head[u];i;i=e[i].nxt)
		{
			int v=e[i].to;
			if(!--deg[v]) Q.push(make_pair(-a[v],v));
		}
	}
}
void adde(int a,int b)
{ 
	e[++ce].to=b,e[ce].nxt=head[a],head[a]=ce,++deg[b];
}
int main()
{
	//freopen("permutation.in","r",stdin); freopen("permutation.out","w",stdout);
	scanf("%d%d",&n,&K);
	for(int i=1;i<=n;++i) scanf("%d",&p[i]);
	for(int i=1;i<=n;++i) a[p[i]]=i;
	Build(1,n,1);
	for(int i=n;i>=1;--i)
	{
		int x=Query(a[i]+1,min(a[i]+K-1,n),1);
		if(x<inf) adde(i,x);
		x=Query(max(a[i]-K+1,1),a[i]-1,1);
		if(x<inf) adde(i,x);
		Insert(a[i],1);
	}
	topsort();
	for(int i=1;i<=n;++i) ord[i]=a[ord[i]];
	for(int i=1;i<=n;++i) ans[ord[i]]=i;
	for(int i=1;i<=n;++i) printf("%d\n",ans[i]);
	return 0;
}