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 MAXN = 500010;

template<typename T> inline T read() {
	T x(0), f(1);
	char ch = getchar();
	for(; !isdigit(ch); ch = getchar()) if(ch=='-') f=-1;
	for(; isdigit(ch); ch = getchar()) x = (x*10)+(ch^48);
	return x * f;
}

int n, K, p[MAXN];
int P[MAXN];

namespace Seg_T{
#define ls(p) (p<<1)
#define rs(p) (p<<1|1)
#define mid ((l+r)>>1)
	int Max[MAXN<<2];

	inline int query(int p, int l, int r, int x, int y) {
		if(x > y) return 0;
		if(l == x && r == y) return Max[p];
		if(y <= mid) return query(ls(p), l, mid, x, y);
		if(x > mid) return query(rs(p), mid+1, r, x, y);
		return max(query(ls(p), l, mid, x, mid), query(rs(p), mid+1, r, mid+1, y));
	}

	inline void modify(int p, int l, int r, int c, int v) {
		if(l == r) {
			Max[p] = v;
			return;
		}
		if(c <= mid) modify(ls(p), l, mid, c, v);
		else modify(rs(p), mid+1, r, c, v);
		Max[p] = max(Max[ls(p)], Max[rs(p)]);
	}
}

int e, ans[MAXN], cnt;
vector<int> G[MAXN];
inline void Add(int u, int v) {
	//printf("%d %d\n", u, v);
	G[u].push_back(v);
}

void dfs(int u) {
	ans[++cnt] = u;
	sort(G[u].begin(), G[u].end());
	for(int i = 0; i < (int)G[u].size(); i++) dfs(G[u][i]);
}

int main() {
	n = read<int>(), K = read<int>();
	for(int i = 1; i <= n; i++) {
		p[i] = read<int>();
		P[p[i]] = i;
	}

	P[n+1] = n+1;
	Add(n+1, P[1]);
	Seg_T::modify(1, 1, n, P[1], 1);
	for(int i = 2; i <= n; i++) {
		int j = Seg_T::query(1, 1, n, P[i]+1, min(n, P[i]+K-1));
		if(!j) j = n+1;
		Add(P[j], P[i]);
		Seg_T::modify(1, 1, n, P[i], i);
	}

	dfs(n+1);

	for(int i = 2; i <= cnt; i++) p[ans[i]] = i-1;
	for(int i = 1; i <= n; i++) 
		printf("%d\n", p[i]);
	return 0;
}
