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;
template <typename A, typename B>
inline void chmin(A &a, B b) {
  if (a > b) a = b;
}
template <typename A, typename B>
inline void chmax(A &a, B b) {
  if (a < b) a = b;
}
const long long INF = 1001001001001001001ll;
struct segtree {
  static const long long SEG = 1 << 19;
  vector<long long> dat;
  segtree() : dat(SEG * 2, INF) {}
  void update(long long k, long long x) {
    k += SEG - 1;
    dat[k] = x;
    while (k) {
      k = (k - 1) / 2;
      dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
  }
  long long query(long long a, long long b, long long k = 0, long long l = 0,
                  long long r = SEG) {
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return dat[k];
    return min(query(a, b, k * 2 + 1, l, (l + r) / 2),
               query(a, b, k * 2 + 2, (l + r) / 2, r));
  }
};
long long N, K;
long long S[555555];
vector<long long> G[555555];
vector<long long> X[555555];
long long par[20][555555];
long long dep[555555];
vector<long long> latte;
void dfs(long long v) {
  sort((X[v]).begin(), (X[v]).end());
  for (auto u : X[v]) {
    dfs(u);
  }
  latte.push_back(v);
}
signed main() {
  scanf("%lld%lld", &N, &K);
  for (long long i = 0; i < (N); i++) {
    long long p;
    scanf("%lld", &p);
    p--;
    S[p] = i + 1;
  }
  segtree seg;
  for (long long i = N - 1; i >= 0; i--) {
    long long tmp = seg.query(S[i] + 1, S[i] + K);
    if (tmp < N) G[S[i]].push_back(S[tmp]);
    tmp = seg.query(S[i] - K + 1, S[i]);
    if (tmp < N) G[S[i]].push_back(S[tmp]);
    seg.update(S[i], i);
  }
  for (long long i = 1; i <= N; i++) G[i].push_back(0);
  vector<long long> ord;
  vector<long long> deg(N + 1);
  for (long long i = 0; i < (N + 1); i++)
    for (auto u : G[i]) deg[u]++;
  for (long long i = 0; i < (N + 1); i++)
    if (deg[i] == 0) ord.push_back(i);
  for (long long i = 0; i < (ord.size()); i++) {
    long long v = ord[i];
    for (auto u : G[v]) {
      if (--deg[u] == 0) ord.push_back(u);
    }
  }
  for (long long i = 0; i < (20); i++) par[i][0] = -1;
  reverse((ord).begin(), (ord).end());
  for (auto v : ord) {
    if (v == 0) continue;
    vector<long long> lis;
    for (auto u : G[v]) {
      if (u == 0) continue;
      if (u < v) {
        lis.push_back(u);
        continue;
      }
      for (long long i = 19; i >= 0; i--) {
        if (par[i][u] > v) u = par[i][u];
      }
      lis.push_back(par[0][u]);
    }
    if (lis.size() == 0) {
      dep[v] = dep[0] + 1;
      par[0][v] = 0;
    } else if (lis.size() == 1) {
      dep[v] = dep[lis[0]] + 1;
      par[0][v] = lis[0];
    } else {
      if (dep[lis[0]] < dep[lis[1]]) swap(lis[0], lis[1]);
      long long a = lis[0];
      long long b = lis[1];
      for (long long i = 0; i < (20); i++)
        if ((dep[a] - dep[b]) >> i & 1) a = par[i][a];
      for (long long i = 19; i >= 0; i--)
        if (par[i][a] != par[i][b]) a = par[i][a], b = par[i][b];
      if (a <= b) {
        par[0][v] = lis[0];
      } else {
        par[0][v] = lis[1];
      }
      dep[v] = dep[par[0][v]] + 1;
    }
    for (long long i = 0; i < 19; i++) {
      if (par[i][v] == -1)
        par[i + 1][v] = -1;
      else
        par[i + 1][v] = par[i][par[i][v]];
    }
  }
  for (long long i = 1; i <= N; i++) X[par[0][i]].push_back(i);
  dfs(0);
  vector<long long> ans(N);
  for (long long i = 0; i < (N); i++) {
    ans[latte[i] - 1] = i;
  }
  for (long long i = 0; i < (N); i++) printf("%lld\n", latte[i]);
  return 0;
}
