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 SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 5e5 + 100;

struct IDX{
	int P;
	vector<pi> val;
	IDX(int n = 10) {
		for(P=1; P<n; P<<=1);
		val = vector<pi>(2*P, pi(0, 0));
	}
	void update(int v, pi k) {
		val[v+=P] = k;
		while(v>>=1) val[v] = max(val[v*2], val[v*2+1]);
	}
	pi getMax(int a, int b) {
		pi res = pi(-1, 0);
		for(a+=P, b+=P; a<=b; a>>=1, b>>=1) {
			if(a%2==1) res = max(res, val[a++]);
			if(b%2==0) res = max(res, val[b--]);
		}
		return res;
	}
};

int N, K, Nr[MAX_N];
int Ans[MAX_N];
IDX idx;
int main() {
	cin >> N >> K;
	idx = IDX(N);
	for(int i=0; i<N; i++) scanf("%d", &Nr[i]);
	for(int i=0; i<N; i++) idx.update(i, pi(Nr[i], i));
	vector<bool> vis(N, false);
	priority_queue<int> Q;
	for(int i=0; i<N; i++) {
		int v, ix; tie(v, ix) = idx.getMax(max(0, i-K+1), min(N-1, i+K-1));
		if(ix == i) Q.emplace(i), vis[i] = true;
	}
	int cnt = 0;
	while(!Q.empty()) {
		int v = Q.top(); Q.pop();
		Ans[v] = N - cnt;
		cnt++;
		idx.update(v, pi(-1, v));
		Nr[v] = -1;
		int g = v/K;
		for(int k=max(0, g-1); k<=min((N-1)/K, g+1); k++) {
			int w, wix; tie(w, wix) = idx.getMax(k*K, min(N-1, (k+1)*K));
			if(vis[wix]) continue;
			int same; tie(ignore, same) = idx.getMax(max(0, wix-K+1), min(N-1, wix+K-1));
			if(same == wix) Q.emplace(wix), vis[wix] = true;
		}
	}
	for(int i=0; i<N; i++) printf("%d\n", Ans[i]);
	return 0;
}
