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<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<queue>
using namespace std;
typedef long long s64;

const int ONE = 1000005;
const int INF = 2147483640;

int get()
{
		int res = 1, Q = 1; char c;
		while( (c = getchar()) < 48 || c > 57)
			if(c == '-') Q = -1;
		if(Q) res = c - 48;
		while( (c = getchar()) >= 48 && c <= 57)
			res = res * 10 + c - 48;
		return res * Q;
}

int n, k;
int A[ONE], p[ONE];
int next[ONE], first[ONE], go[ONE], Input[ONE], tot;
priority_queue <int, vector <int>, greater <int> > q;

int res = INF;
namespace Seg
{
		struct power {int val;} Node[ONE * 4];
		void Build(int i, int l, int r)
		{
			Node[i].val = INF;
			if(l == r) return;
			int mid = l + r >> 1;
			Build(i << 1, l, mid), Build(i << 1 | 1, mid + 1, r);
		}

		void Update(int i, int l, int r, int L, int x)
		{
			if(L <= l && r <= L)
			{
				Node[i].val = x;
				return;
			}
			int mid = l + r >> 1;
			if(L <= mid) Update(i << 1, l, mid, L, x);
			else Update(i << 1 | 1, mid + 1, r, L, x);
			Node[i].val = min(Node[i << 1].val, Node[i << 1 | 1].val);
		}

		void Query(int i, int l, int r, int L, int R)
		{
			if(L > R) return;
			if(L <= l && r <= R)
			{
				res = min(res, Node[i].val);
				return;
			}
			int mid = l + r >> 1;
			if(L <= mid) Query(i << 1, l, mid, L, R);
			if(mid + 1 <= R) Query(i << 1 | 1, mid + 1, r, L, R);
		}
}

void Add(int u, int v)
{
		Input[v]++, next[++tot] = first[u], first[u] = tot, go[tot] = v;
}

void Deal()
{
		int now = 0;
		for(int i = 1; i <= n; i++)
			if(!Input[i]) q.push(i);
		while(!q.empty())
		{
			int u = q.top(); q.pop();
			A[u] = ++now;
			for(int e = first[u]; e; e = next[e])
			{
				int v = go[e];
				if(--Input[v] == 0) q.push(v);
			}
		}
		for(int i = 1; i <= n; i++) printf("%d\n", A[i]);
}

int main()
{
		//freopen("permutation.in","r",stdin);
		//freopen("permutation.out","w",stdout);
		n = get(), k = get();
		for(int i = 1; i <= n; i++) p[get()] = i;

		Seg::Build(1, 1, n);
		for(int i = n; i >= 1; i--)
		{
			res = INF, Seg::Query(1, 1, n, p[i] + 1, min(p[i] + k - 1, n));
			if(res != INF) Add(p[i], p[res]);

			res = INF, Seg::Query(1, 1, n, max(1, p[i] - k + 1), p[i] - 1);
			if(res != INF) Add(p[i], p[res]);

			Seg::Update(1, 1, n, p[i], i);
		}

		Deal();
}