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>
#define Inf 0x3f3f3f3f
#define rg register
#define lson x << 1, l, mid
#define rson x << 1 | 1, mid + 1, r
using namespace std;
typedef long long ll;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 5e5 + 5;
inline int read()
{
	rg int res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
int n, k, cnt;
int p[Maxn], pos[Maxn], fir[Maxn], ind[Maxn], ans[Maxn], tree[Maxn << 2];
struct
{
	int to, last;
} e[2*Maxn];
void con(int u, int v)
{
	e[++cnt].to = v;
	e[cnt].last = fir[u];
	fir[u] = cnt;
	ind[v]++;
}
void Insert(rg int x,rg int l,rg int r,rg int pos,rg int s)
{
	if (l == r)
	{
		tree[x] = s;
		return;
	}
	rg int mid = l + r >> 1;
	if (pos <= mid)
		Insert(lson, pos, s);
	else
		Insert(rson, pos, s);
	tree[x] = min(tree[x << 1], tree[x << 1 | 1]);
}
int Query(rg int x,rg int l,rg int r,rg int nl,rg int nr)
{
	if (nl > nr)
		return Inf;
	if (nl <= l && r <= nr)
		return tree[x];
	rg int mid = l + r >> 1, res = Inf;
	if (nl <= mid)
		res = Query(lson, nl, nr);
	if (nr > mid)
		res = min(res, Query(rson, nl, nr));
	return res;
}
priority_queue<int, vector<int>, greater<int> > q;
void topo_sort()
{
	rg int x;
	for (rg int i = 1; i <= n; i++)
	{
		x = q.top();
		q.pop();
		pos[i] = x;
		for (rg int next = fir[x], nx; next; next = e[next].last)
		{
			nx = e[next].to;
			ind[nx]--;
			if (!ind[nx])
				q.push(nx);
		}
	}
}
int main()
{
	memset(tree, 0x3f, sizeof(tree));
	rg int a;
	freopen("permutation.in", "r", stdin);
	freopen("permutation.out", "w", stdout);
	cin >> n >> k;
	for (int i = 1; i <= n; i++)
	{
		a = read();
		p[a] = i;
	}
	Insert(1, 1, n, p[n], n);
	for (rg int i = n - 1; i >= 1; i--)
	{
		a = Query(1, 1, n, max(1, p[i] - k + 1), p[i] - 1);
		if (a != Inf)
			con(p[i], p[a]);
		a = Query(1, 1, n, p[i] + 1, min(p[i] + k - 1, n));
		if (a != Inf)
			con(p[i], p[a]);
		Insert(1, 1, n, p[i], i);
	}
	for (int i = 1; i <= n; i++)
		if (!ind[p[i]])
			q.push(p[i]);
	topo_sort();
	for (int i = 1; i <= n; i++)
		ans[pos[i]] = i;
	for (int i = 1; i <= n; i++)
		printf("%d\n", ans[i]);
	return 0;
}
