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;
typedef long long ll;
typedef pair<int,int> pp;
typedef pair<ll,ll> pll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ scanf("%lld",&x); }
template<typename T,typename... Args>
void read(T& a,Args&... b){ read(a); read(b...); }
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
#define x first
#define y second

int n, k;

int pos[500010];
const int M = 524288;
int vert[M<<1];
int ind;
int start[1000'0000];
int ep[2000'0000];
int nxt[2000'0000];
int realind[1200'0000];
int indeg[1200'0000];
int en;

inline void add_edge(int f, int t){
	f=vert[f]; t=vert[t];
	if(!f) return;
	++indeg[t];
	++en;
	nxt[en]=start[f];
	start[f]=en;
	ep[en]=t;
}

void connect(int l, int r, int to){
	l=max(l, 1); r=min(r, n);
	l+=M; r+=M;
	auto f = [&](int x){
		add_edge(x, to);
	};
	while(l<=r){
		if(l%2==1) f(l++);
		if(r%2==0) f(r--);
		l/=2; r/=2;
	}
}

priority_queue<pp> pq;

int ans[500010];
int que[1200'0000];
int head, tail;

void bfs(int x){
	head=1; tail=0; que[0]=x;
	while(tail<head){
		int x=que[tail++];
		if(realind[x]){
			pq.emplace(-realind[x], x);
			continue;
		}
		int ei=start[x];
		while(ei){
			int j=ep[ei];
			if(!--indeg[j]){
				que[head++]=j;
			}
			ei=nxt[ei];
		}
	}
}

int main()
{
	read(n, k);
	for(int i=1; i<=n; ++i){
		int x; read(x);
		pos[x]=i;
	}
	
	for(int i=1; i<=n; ++i){
		int x=pos[i];
		realind[++ind] = x;
		vert[M+x] = ind;
		for(int p=(M+x)/2;p;p/=2){
			if(!vert[p*2] || !vert[p*2+1]){
				vert[p] = vert[p*2] + vert[p*2+1];
			} else {
				vert[p] = ++ind;
				add_edge(p*2, p);
				add_edge(p*2+1, p);
			}
		}
		
		connect(x-k+1, x-1, M+x);
		connect(x+1, x+k-1, M+x);
	}
	for(int i=1; i<=ind; ++i) if(indeg[i]==0) bfs(i);
	int an = 0;
	while(pq.size()){
		int i=pq.top().second; pq.pop();
		if(realind[i]){
			ans[realind[i]] = ++an;
			realind[i]=0;
		}
		bfs(i);
	}
	for(int i=1; i<=n; ++i){
		printf("%d\n", ans[i]);
	}
	return 0;
}
