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 maxn 500015
#define ll long long
#define db double
#define vi vector<int>
#define pb push_back
#define mod 998244353
// head
struct ST {
	int l, r;
	ST *ch[2];
	int sum, mxs;
}p[maxn * 10], *rt[3];
int stcnt = 0;
int x[maxn];
void upd(ST *a) {
	a->sum = a->ch[0]->sum + a->ch[1]->sum, 
	a->mxs = max(a->ch[0]->mxs, a->ch[1]->mxs);
}
void bdtree(ST *a, int l, int r) {
	a->l = l, a->r = r;
	if (l == r) {
		a->sum = a->mxs = x[l];
		return ;
	}
	int mid = (l + r) >> 1;
	a->ch[0] = &p[stcnt++], 
	a->ch[1] = &p[stcnt++];
	bdtree(a->ch[0], l, mid), 
	bdtree(a->ch[1], mid + 1, r);
	upd(a);
}
void ch(ST *a, int pl, int num) {
	if (a->l == a->r) {
		a->sum = a->mxs = num;
		return ;
	}
	int mid = (a->l + a->r) >> 1;
	if (pl <= mid) ch(a->ch[0], pl, num);
	else ch(a->ch[1], pl, num);
	upd(a);
}
int qsum(ST *a, int l, int r) {
	if (a->l == l && a->r == r)
		return a->sum;
	int mid = (a->l + a->r) >> 1;
	if (r <= mid) return qsum(a->ch[0], l, r);
	else if (l > mid) return qsum(a->ch[1], l, r);
	else return qsum(a->ch[0], l, mid) + qsum(a->ch[1], mid + 1, r);
}
int qmx(ST *a, int l, int r) {
	if (a->l == l && a->r == r)
		return a->mxs;
	int mid = (a->l + a->r) >> 1;
	if (r <= mid) return qmx(a->ch[0], l, r);
	else if (l > mid) return qmx(a->ch[1], l, r);
	else return max(qmx(a->ch[0], l, mid), qmx(a->ch[1], mid + 1, r));	
}
int qpl(ST *a, int num) {
//	cout << "Q" << a->l << ' ' << a->r << ' ' << num << endl;
	if (a->l == a->r) return a->l;
	if (a->ch[0]->sum >= num) return qpl(a->ch[0], num);
	else return qpl(a->ch[1], num - a->ch[0]->sum);
}
int n, k, r[maxn], q[maxn], sm[maxn], f[maxn];
int main() {
	scanf("%d%d", &n, &k);
	k--;
	for (int i = 1; i <= n; i++)
		scanf("%d", &r[i]), 
		q[r[i]] = i;
	rt[0] = &p[stcnt++], rt[1] = &p[stcnt++];
	bdtree(rt[0], 1, n), 
	bdtree(rt[1], 1, n);
	for (int i = 1; i <= n; i++) {	
		int th = q[i];	
		int nm = q[qmx(rt[1], th, min(n, th + k))];
		sm[th] = 1;	
		if (nm) 
			sm[th] += qsum(rt[0], th, nm - 1), 
			sm[th] += sm[nm];
		ch(rt[0], th, 1), 
		ch(rt[1], th, i);
	}
	for (int i = 1; i <= n; i++)
		x[i] = 1;
//	stcnt = 0;
	rt[2] = &p[stcnt++];
	bdtree(rt[2], 1, n);
	for (int i = 1; i <= n; i++) {	
		int npl = qpl(rt[2], sm[i]);
		f[npl] = i;
		ch(rt[2], npl, 0);
	}
	for (int i = 1; i <= n; i++) 
		printf("%d\n", f[i]);
	return 0;
}
