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;
int n, K, w[501000], R[501000], top, INF = 1e8, G[501000],
                                     IT2[524288 + 524288 + 1];
struct Tree {
  long long M, K;
} IT[524288 + 524288 + 1];
void Add(int nd, long long k) { IT[nd].M += k, IT[nd].K += k; }
void UDT(int nd) { IT[nd].M = min(IT[nd * 2].M, IT[nd * 2 + 1].M); }
void init(int nd, int b, int e) {
  if (b == e) {
    Add(nd, INF);
    return;
  }
  int m = (b + e) >> 1;
  init(nd * 2, b, m);
  init(nd * 2 + 1, m + 1, e);
  UDT(nd);
}
void Spread(int nd) {
  Add(nd * 2, IT[nd].K);
  Add(nd * 2 + 1, IT[nd].K);
  IT[nd].K = 0;
}
void Ins(int nd, int b, int e, int s, int l, int x) {
  if (b == s && e == l) {
    Add(nd, x);
    return;
  }
  Spread(nd);
  int m = (b + e) >> 1;
  if (s <= m) Ins(nd * 2, b, m, s, min(m, l), x);
  if (l > m) Ins(nd * 2 + 1, m + 1, e, max(m + 1, s), l, x);
  UDT(nd);
}
void Put(int nd, int b, int e, int p, int x) {
  if (b == e) {
    IT[nd].M = IT[nd].K = x;
    return;
  }
  Spread(nd);
  int m = (b + e) >> 1;
  if (p <= m)
    Put(nd * 2, b, m, p, x);
  else
    Put(nd * 2 + 1, m + 1, e, p, x);
  UDT(nd);
}
int Min(int nd, int b, int e, int s, int l) {
  if (b == s && e == l) return IT[nd].M;
  Spread(nd);
  int r = INF;
  int m = (b + e) >> 1;
  if (s <= m) r = min(r, Min(nd * 2, b, m, s, min(m, l)));
  if (l > m) r = min(r, Min(nd * 2 + 1, m + 1, e, max(m + 1, s), l));
  return r;
}
void Ins2(int a, int b) {
  a += 524288;
  IT2[a] = b;
  while (a != 1) {
    a >>= 1;
    IT2[a] = IT2[a * 2] + IT2[a * 2 + 1];
  }
}
int Get(int s) {
  int nd = 1;
  while (nd < 524288) {
    nd *= 2;
    if (IT2[nd] < s) {
      s -= IT2[nd];
      nd++;
    }
  }
  return nd - 524288;
}
int main() {
  int i, t;
  scanf("%d%d", &n, &K);
  if (n > 2000) return 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &R[i]);
    w[R[i]] = i;
  }
  init(1, 1, n);
  for (i = 1; i <= n; i++) {
    t = min(Min(1, 1, n, 1, min(n, w[i] + K - 1)), i);
    G[i] = i - t + 1;
    Put(1, 1, n, w[i], t);
    if (w[i] > 1) Ins(1, 1, n, 1, w[i] - 1, 1);
  }
  for (i = 1; i <= n; i++) Ins2(i, 1);
  for (i = n; i >= 1; i--) {
    t = Get(G[i]);
    R[w[i]] = t;
    Ins2(t, 0);
  }
  for (i = 1; i <= n; i++) printf("%d\n", R[i]);
}
