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;
const int MAXN = 1e6 + 51, inf = 0x3f3f3f3f;
struct Edge {
  int to, prev;
};
struct SegmentTree {
  int l, r, minn;
};
Edge ed[MAXN];
SegmentTree tree[MAXN << 2];
priority_queue<int, vector<int>, greater<int> > q;
int cnt, tot, kk, x, ptr;
int last[MAXN], rid[MAXN], deg[MAXN], res[MAXN];
inline int read() {
  register int num = 0, neg = 1;
  register char ch = getchar();
  while (!isdigit(ch) && ch != '-') {
    ch = getchar();
  }
  if (ch == '-') {
    neg = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    num = (num << 3) + (num << 1) + (ch - '0');
    ch = getchar();
  }
  return num * neg;
}
template <class T>
inline int Min(T x, T y) {
  return x < y ? x : y;
}
template <class T>
inline int Max(T x, T y) {
  return x > y ? x : y;
}
inline void addEdge(int from, int to) {
  ed[++tot].prev = last[from];
  ed[tot].to = to;
  last[from] = tot;
}
inline void update(int node) {
  tree[node].minn = Min(tree[node << 1].minn, tree[(node << 1) | 1].minn);
}
inline void create(int l, int r, int node) {
  tree[node].l = l, tree[node].r = r;
  if (tree[node].l == tree[node].r) {
    tree[node].minn = inf;
    return;
  }
  int mid = (l + r) >> 1;
  create(l, mid, node << 1);
  create(mid + 1, r, (node << 1) | 1);
  update(node);
}
inline void changePoint(int pos, int val, int node) {
  if (tree[node].l == tree[node].r) {
    tree[node].minn = val;
    return;
  }
  int mid = (tree[node].l + tree[node].r) >> 1;
  if (pos <= mid) {
    changePoint(pos, val, node << 1);
  } else {
    changePoint(pos, val, (node << 1) | 1);
  }
  update(node);
}
inline int queryMin(int l, int r, int node) {
  if (l <= tree[node].l && r >= tree[node].r) {
    return tree[node].minn;
  }
  int mid = (tree[node].l + tree[node].r) >> 1, res = inf;
  if (l <= mid) {
    res = Min(res, queryMin(l, r, node << 1));
  }
  if (r > mid) {
    res = Min(res, queryMin(l, r, (node << 1) | 1));
  }
  return res;
}
inline void toposort() {
  int top;
  for (register int i = 1; i <= cnt; i++) {
    if (!deg[i]) {
      q.push(i);
    }
  }
  while (!q.empty()) {
    top = q.top(), q.pop(), res[ptr++] = top;
    for (register int i = last[top]; i; i = ed[i].prev) {
      deg[ed[i].to]--;
      if (!deg[ed[i].to]) {
        q.push(ed[i].to);
      }
    }
  }
}
int main() {
  cnt = read(), kk = read();
  for (register int i = 1; i <= cnt; i++) {
    rid[read()] = i;
  }
  create(1, cnt, 1);
  for (register int i = cnt; i; i--) {
    x = queryMin(rid[i] + 1, Min(rid[i] + kk - 1, cnt), 1);
    if (x >= 1 && x <= cnt) {
      addEdge(rid[i], rid[x]), deg[rid[x]]++;
    }
    x = queryMin(Max(rid[i] - kk + 1, 1), rid[i] - 1, 1);
    if (x >= 1 && x <= cnt) {
      addEdge(rid[i], rid[x]), deg[rid[x]]++;
    }
    changePoint(rid[i], i, 1);
  }
  toposort();
  for (register int i = 0; i < ptr; i++) {
    printf("%d\n", res[i]);
  }
}
