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;
long long ksm(long long a, long long b) {
  if (!b) return 1;
  long long ns = ksm(a, b >> 1);
  ns = ns * ns % 998244353;
  if (b & 1) ns = ns * a % 998244353;
  return ns;
}
struct ST {
  int l, r;
  ST *ch[2];
  int sum, mxs;
} p[500015 << 2], *rt[2];
int stcnt = 0;
int x[500015];
void upd(ST *a) {
  a->sum = a->ch[0]->sum + a->ch[1]->sum,
  a->mxs = max(a->ch[0]->mxs, a->ch[1]->mxs);
}
void bdtree(ST *a, int l, int r) {
  a->l = l, a->r = r;
  if (l == r) {
    a->sum = a->mxs = x[l];
    return;
  }
  int mid = (l + r) >> 1;
  a->ch[0] = &p[stcnt++], a->ch[1] = &p[stcnt++];
  bdtree(a->ch[0], l, mid), bdtree(a->ch[1], mid + 1, r);
  upd(a);
}
void ch(ST *a, int pl, int num) {
  if (a->l == a->r) {
    a->sum = a->mxs = num;
    return;
  }
  int mid = (a->l + a->r) >> 1;
  if (pl <= mid)
    ch(a->ch[0], pl, num);
  else
    ch(a->ch[1], pl, num);
  upd(a);
}
int qsum(ST *a, int l, int r) {
  if (a->l == l && a->r == r) return a->sum;
  int mid = (a->l + a->r) >> 1;
  if (r <= mid)
    return qsum(a->ch[0], l, r);
  else if (l > mid)
    return qsum(a->ch[1], l, r);
  else
    return qsum(a->ch[0], l, mid) + qsum(a->ch[1], mid + 1, r);
}
int qmx(ST *a, int l, int r) {
  if (a->l == l && a->r == r) return a->mxs;
  int mid = (a->l + a->r) >> 1;
  if (r <= mid)
    return qmx(a->ch[0], l, r);
  else if (l > mid)
    return qmx(a->ch[1], l, r);
  else
    return max(qmx(a->ch[0], l, mid), qmx(a->ch[1], mid + 1, r));
}
int qpl(ST *a, int num) {
  if (a->l == a->r) return a->l;
  if (a->ch[0]->sum >= num)
    return qpl(a->ch[0], num);
  else
    return qpl(a->ch[1], num - a->ch[0]->sum);
}
int n, k, r[500015], q[500015], sm[500015], f[500015];
int main() {
  scanf("%d%d", &n, &k);
  k--;
  for (int i = 1; i <= n; i++) scanf("%d", &r[i]), q[r[i]] = i;
  rt[0] = &p[stcnt++], rt[1] = &p[stcnt++];
  bdtree(rt[0], 1, n), bdtree(rt[1], 1, n);
  for (int i = 1; i <= n; i++) {
    int th = q[i];
    int nm = q[qmx(rt[1], th, min(n, th + k))];
    sm[th] = 1;
    if (nm) sm[th] += qsum(rt[0], th, nm - 1), sm[th] += sm[nm];
    ch(rt[0], th, 1), ch(rt[1], th, i);
  }
  for (int i = 1; i <= n; i++) x[i] = 1;
  stcnt = 0;
  rt[0] = &p[stcnt++];
  bdtree(rt[0], 1, n);
  for (int i = 1; i <= n; i++) {
    int npl = qpl(rt[0], sm[i]);
    f[npl] = i;
    ch(rt[0], npl, 0);
  }
  for (int i = 1; i <= n; i++) printf("%d\n", f[i]);
  return 0;
}
