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 pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MN = 500010;
const int SZ = 1 << 19;

struct segtree_max {
	vector<pii> dat;

	void init() {
		dat.resize(SZ * 2);
		rep(i, SZ * 2) dat[i] = mp(INT_MIN, -1);
	}

	void update(int pos, int x) {
		pos += SZ - 1;
		dat[pos] = mp(x, pos - (SZ - 1));

		while (pos > 0) {
			pos = (pos - 1) / 2;
			dat[pos] = max(dat[pos * 2 + 1], dat[pos * 2 + 2]);
		}
	}

	pii get(int a, int b, int k = 0, int l = 0, int r = SZ) {
		if (b <= l || r <= a) return mp(INT_MIN, -1);
		if (a <= l && r <= b) return dat[k];
		return max(get(a, b, k * 2 + 1, l, (l + r) / 2), get(a, b, k * 2 + 2, (l + r) / 2, r));
	}
} seg;

int N, K;
int P[MN], Q[MN];
vi g[MN];
int in[MN];

int main() {
	scanf("%d %d", &N, &K);

	rep(i, N) {
		scanf("%d", &P[i]);
		--P[i];
		Q[P[i]] = i;
	}

	seg.init();

	rep(i, N) {
		int p = Q[i];

		pii r = seg.get(p, min(N, p + K));
		pii l = seg.get(max(0, p + 1 - K), p);

		if (r.fi != INT_MIN) {
			++in[p];
			g[r.se].pb(p);
		}

		if (l.fi != INT_MIN) {
			++in[p];
			g[l.se].pb(p);
		}

		seg.update(p, i);
	}

	priority_queue<int, vi, greater<int>> que;

	rep(i, N) {
		if (in[i] == 0) {
			que.push(i);
		}
	}

	vi res(N), ans(N);
	int now = 0;

	while (!que.empty()) {
		int v = que.top(); que.pop();
		res[now++] = v;

		for (int to : g[v]) {
			if (--in[to] == 0) {
				que.push(to);
			}
		}
	}

	rep(i, N) ans[res[i]] = i;

	rep(i, N) printf("%d\n", ans[i] + 1);

	return 0;
}