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;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int INF = 9999999;
const int MAXN = 500010;
int N, K;
int p[MAXN + 1], q[MAXN + 1];
set<int> s;
vector<int> vec[MAXN + 1];
int tr[MAXN << 2];
int deg[MAXN + 1];
inline void Add(int rt, int l, int r, int k, int x) {
  if (l == r) {
    tr[rt] = min(tr[rt], x);
    return;
  }
  int mid = (l + r) >> 1;
  if (k <= mid)
    Add(rt << 1, l, mid, k, x);
  else
    Add(rt << 1 | 1, mid + 1, r, k, x);
  tr[rt] = min(tr[rt << 1], tr[rt << 1 | 1]);
  return;
}
inline int Query(int rt, int l, int r, int L, int R) {
  if (L <= l && R >= r) return tr[rt];
  int mid = (l + r) >> 1, ans = INF;
  if (L <= mid) ans = min(ans, Query(rt << 1, l, mid, L, R));
  if (R > mid) ans = min(ans, Query(rt << 1 | 1, mid + 1, r, L, R));
  return ans;
}
inline void insert(int u, int v) {
  ++deg[v];
  vec[u].push_back(v);
  return;
}
int main() {
  N = read(), K = read();
  for (int i = 1; i <= N; i++) {
    p[i] = read();
    q[p[i]] = i;
  }
  memset(tr, 127, sizeof(tr));
  for (int i = N; i >= 1; i--) {
    int x = Query(1, 1, N, max(1, q[i] - K + 1), q[i]);
    int y = Query(1, 1, N, p[i], min(N, q[i] + K - 1));
    if (x <= N) insert(q[i], q[x]);
    if (y <= N) insert(q[i], q[y]);
    Add(1, 1, N, q[i], i);
  }
  for (int i = 1; i <= N; i++)
    if (!deg[i]) s.insert(i);
  int cnt = 0;
  while (s.size()) {
    int k = (*s.begin());
    q[++cnt] = k;
    s.erase(s.begin());
    for (int i = 0; i < vec[k].size(); i++) {
      int v = vec[k][i];
      if (!deg[v]) continue;
      deg[v]--;
      if (!deg[v]) s.insert(v);
    }
  }
  for (int i = 1; i <= N; i++) p[q[i]] = i;
  for (int i = 1; i <= N; i++) printf("%d\n", p[i]);
  return 0;
}
