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;
vector<int> vec;
struct node {
  int v, nex;
} e[500010 << 1];
int n, k, t, p[500010], q[500010], dgr[500010], head[500010], ans[500010],
    inf = 0x3f3f3f3f;
int Min[2000010];
int cmin(int x, int y) { return x < y ? x : y; }
int cmax(int x, int y) { return x > y ? x : y; }
void add(int x, int y) { e[++t].v = y, e[t].nex = head[x], head[x] = t; }
namespace Seg_Tree {
void pushup(int root) { Min[root] = cmin(Min[root << 1], Min[root << 1 | 1]); }
void update(int root, int l, int r, int tag, int x) {
  if (l == r) {
    Min[root] = x;
    return;
  }
  if (tag <= ((l + r) >> 1))
    update(root << 1, l, ((l + r) >> 1), tag, x);
  else
    update(root << 1 | 1, ((l + r) >> 1) + 1, r, tag, x);
  pushup(root);
}
int query(int root, int l, int r, int tagl, int tagr) {
  if (l >= tagl && r <= tagr) return Min[root];
  int tmp = inf;
  if (tagl <= ((l + r) >> 1))
    tmp = query(root << 1, l, ((l + r) >> 1), tagl, tagr);
  if (tagr > ((l + r) >> 1))
    tmp = cmin(tmp, query(root << 1 | 1, ((l + r) >> 1) + 1, r, tagl, tagr));
  return tmp;
}
}  // namespace Seg_Tree
void topsort() {
  priority_queue<int, vector<int>, greater<int> > q;
  int u, num = 0;
  for (register int i = (1); i <= (n); i = -(~(i)))
    if (!dgr[i]) q.push(i);
  while (!q.empty()) {
    u = q.top(), q.pop();
    ans[++num] = u;
    for (register int i = head[u], v = e[i].v; i; i = e[i].nex, v = e[i].v)
      if (!(--dgr[v])) q.push(v);
  }
  for (register int i = (1); i <= (n); i = -(~(i))) printf("%d\n", p[ans[i]]);
}
int main() {
  using namespace Seg_Tree;
  int x = 0x3f3f3f3f, y = 0x3f3f3f3f;
  scanf("%d%d", &n, &k);
  for (register int i = (1); i <= (n); i = -(~(i)))
    scanf("%d", &p[i]), q[p[i]] = i;
  memset(Min, 0x3f, sizeof Min);
  for (register int i = (n); i >= (1); i = ~(-(i))) {
    if (q[i] > 1) {
      x = query(1, 1, n, cmax(1, q[i] - k + 1), q[i] - 1);
      if (x ^ inf) add(q[i], q[x]), ++dgr[q[x]];
    }
    if (q[i] < n) {
      y = query(1, 1, n, q[i] + 1, cmin(q[i] + k - 1, n));
      if (y ^ inf) add(q[i], q[y]), ++dgr[q[y]];
    }
    update(1, 1, n, q[i], i);
  }
  return topsort(), 0;
}
