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 bin[40], lg[1 << 21];
namespace mine {
const int INF = 0x3f3f3f3f;
const long long LLINF = 0x3f3f3f3f3f3f3f3fll;
long long qread() {
  long long ans = 0;
  char c = getchar();
  int f = 1;
  while (c < '0' or c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while ('0' <= c and c <= '9') ans = ans * 10 + c - '0', c = getchar();
  return ans * f;
}
void write(long long num) {
  if (num < 0) {
    num = -num;
    putchar('-');
  }
  if (num > 9) write(num / 10);
  putchar('0' + num % 10);
}
void writeln(int num) {
  write(num);
  puts("");
}
void chmax(int &x, const int y) { x = x > y ? x : y; }
void chmin(int &x, const int y) { x = x < y ? x : y; }
const int MAX_N = 5e5 + 10;
const int MOD = 1e9 + 7;
void add(int &x, int y) {
  x += y;
  if (x >= MOD) x -= MOD;
  if (x < 0) x += MOD;
}
struct SegmentTree {
  pair<int, int> mx[MAX_N * 4];
  void change(int x, int l, int r, int p, int c) {
    mx[x] = max(mx[x], make_pair(c, p));
    if (l == r) return;
    if (p <= ((l + r) >> 1))
      change(2 * x, l, ((l + r) >> 1), p, c);
    else
      change(2 * x + 1, ((l + r) >> 1) + 1, r, p, c);
  }
  pair<int, int> ask(int x, int l, int r, int fl, int fr) {
    if (fl > fr) return make_pair(0, 0);
    if (l == fl and r == fr) return mx[x];
    if (fr <= ((l + r) >> 1)) return ask(2 * x, l, ((l + r) >> 1), fl, fr);
    if (fl > ((l + r) >> 1))
      return ask(2 * x + 1, ((l + r) >> 1) + 1, r, fl, fr);
    return max(ask(2 * x, l, ((l + r) >> 1), fl, ((l + r) >> 1)),
               ask(2 * x + 1, ((l + r) >> 1) + 1, r, ((l + r) >> 1) + 1, fr));
  }
} sgt;
int a[MAX_N], ans[MAX_N];
int ru[MAX_N];
vector<int> to[MAX_N];
void ins(int x, int y) {
  ru[y]++;
  to[x].push_back(y);
}
priority_queue<int> q;
void main() {
  int n = qread(), K = qread();
  for (int i = 1; i <= n; i++) a[qread()] = i;
  for (int i = 1; i <= n; i++) {
    int num = a[i];
    sgt.change(1, 1, n, num, i);
    pair<int, int> a = sgt.ask(1, 1, n, max(1, num - K + 1), num - 1);
    if (a.first > 0) ins(num, a.second);
    pair<int, int> b = sgt.ask(1, 1, n, num + 1, min(num + K - 1, n));
    if (b.first > 0) ins(num, b.second);
  }
  for (int i = 1; i <= n; i++)
    if (ru[i] == 0) q.push(i);
  for (int now = n; now >= 1; now--) {
    int x = q.top();
    q.pop();
    ans[x] = now;
    for (int t = 0; t < (int)to[x].size(); t++) {
      int y = to[x][t];
      ru[y]--;
      if (ru[y] == 0) q.push(y);
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", ans[i]);
}
};  // namespace mine
int main() {
  srand(time(0));
  bin[0] = 1;
  for (int i = 1; i <= 30; i++) bin[i] = bin[i - 1] << 1;
  lg[1] = 0;
  for (int i = 2; i < (1 << 21); i++) lg[i] = lg[i >> 1] + 1;
  mine::main();
}
