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;
using pii = pair<int, int>;
using vi = vector<int>;
using ll = long long;
const int N = 5e4;
const int INF = 1e9;
struct RMQ {
  int neutro = -1e9;
  int sz;
  pii t[4 * N];
  int &operator[](int p) {
    t[sz + p].second = p;
    return t[sz + p].first;
  }
  void init(int n) {
    sz = 1 << (32 - __builtin_clz(n));
    for (int i = int(0); i < int(2 * sz); i++) t[i] = {neutro, -1};
  }
  void updall() {
    for (int i = int(sz - 1); i >= int(0); i--)
      t[i] = max(t[2 * i], t[2 * i + 1]);
  }
  pii get(int i, int j) { return get(i, j, 1, 0, sz); }
  pii get(int i, int j, int n, int a, int b) {
    if (j <= a || i >= b) return make_pair(neutro, -1);
    if (i <= a && b <= j) return t[n];
    int c = (a + b) / 2;
    return max(get(i, j, 2 * n, a, c), get(i, j, 2 * n + 1, c, b));
  }
  void set(int p, int val) {
    pii act = {val, p};
    for (p += sz; p > 0 && t[p].first != val;) {
      t[p] = act, p /= 2;
      act = max(t[p * 2], t[p * 2 + 1]);
    }
  }
} rmq;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vi p(n);
  for (int &x : p) {
    cin >> x;
    x--;
  }
  rmq.init(n);
  for (int i = int(0); i < int(n); i++) rmq[i] = p[i];
  rmq.updall();
  auto is_maximum = [&p, k, n](int i) {
    int l = max(i - k + 1, 0), r = min(i + k, n);
    return p[i] == rmq.get(l, r).first;
  };
  priority_queue<int> local_maximums;
  for (int i = int(0); i < int(n); i++)
    if (is_maximum(i)) local_maximums.push(i);
  vi ans(n);
  for (int next_id = int(n - 1); next_id >= int(0); next_id--) {
    int local_maximum = -1;
    while (local_maximum == -1 || !is_maximum(local_maximum))
      local_maximum = local_maximums.top(), local_maximums.pop();
    ans[local_maximum] = next_id;
    rmq.set(local_maximum, -INF);
    auto update = [is_maximum, &local_maximums, n, k](int block) {
      if (block < 0 || block * k >= n) return;
      int l = block * k, r = min((block + 1) * k, n);
      int candidate = rmq.get(l, r).second;
      if (candidate >= 0 && is_maximum(candidate))
        local_maximums.push(candidate);
    };
    int block_number = local_maximum / k;
    for (int block = int(block_number - 1); block < int(block_number + 2);
         block++)
      update(block);
  }
  for (int &x : ans) cout << x + 1 << '\n';
  return 0;
}
