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 N = 5e5;
struct SegmentTree {
  struct SgTNode {
    int val;
  } sgt[(N << 2) + 2];
  void pushup(int pos) {
    sgt[pos].val = max(sgt[pos << 1].val, sgt[pos << 1 | 1].val);
  }
  void modify(int pos, int le, int ri, int lrb, int val) {
    if (le == lrb && ri == lrb) {
      sgt[pos].val = val;
      return;
    }
    int mid = (le + ri) >> 1;
    if (lrb <= mid) {
      modify(pos << 1, le, mid, lrb, val);
    } else if (lrb > mid) {
      modify(pos << 1 | 1, mid + 1, ri, lrb, val);
    }
    pushup(pos);
  }
  int querymax(int pos, int le, int ri, int lb, int rb) {
    if (lb <= le && rb >= ri) {
      return sgt[pos].val;
    }
    int mid = (le + ri) >> 1;
    int ret = 0;
    if (rb > mid) {
      ret = max(ret, querymax(pos << 1 | 1, mid + 1, ri, lb, rb));
    }
    if (lb <= mid) {
      ret = max(ret, querymax(pos << 1, le, mid, lb, rb));
    }
    return ret;
  }
} smt;
struct Edge {
  int v, nxt;
} e[(N << 1) + 2];
int a[N + 3];
int b[N + 3];
int ind[N + 3];
int fe[N + 3];
priority_queue<pair<int, int> > pq;
pair<int, int> ans[N + 3];
int fans[N + 3];
int n, m, en;
void addedge(int u, int v) {
  en++;
  e[en].v = v;
  ind[v]++;
  e[en].nxt = fe[u];
  fe[u] = en;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &b[i]);
    a[b[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    ans[i].second = a[i];
    int x = smt.querymax(1, 0, n, max(a[i] - m + 1, 0), a[i]);
    int y = smt.querymax(1, 0, n, a[i], min(a[i] + m - 1, n));
    if (x) {
      addedge(i, x);
    }
    if (y) {
      addedge(i, y);
    }
    smt.modify(1, 0, n, ans[i].second, i);
  }
  for (int i = 1; i <= n; i++)
    if (ind[i] == 0) {
      pq.push(make_pair(a[i], i));
    }
  int j = 0;
  while (!pq.empty()) {
    pair<int, int> tmp = pq.top();
    pq.pop();
    j++;
    b[j] = tmp.first;
    int u = tmp.second;
    for (int i = fe[u]; i; i = e[i].nxt) {
      ind[e[i].v]--;
      if (ind[e[i].v] == 0) {
        pq.push(make_pair(a[e[i].v], e[i].v));
      }
    }
  }
  for (int i = 1; i <= n; i++) fans[b[i]] = i;
  for (int i = 1; i <= n; i++) printf("%d\n", fans[i]);
  return 0;
}
