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;
struct BIT {
  int size;
  vector<int> bit;
  BIT() { size = 0; }
  BIT(int s) {
    size = s;
    bit.resize(size + 1);
    init();
  }
  void init() {
    for (int i = 1; i <= size; i++) bit[i] = 0;
  }
  int query(int i) {
    int ret = 0;
    while (i > 0) {
      ret += bit[i];
      i -= i & (-i);
    }
    return ret;
  }
  void add(int i, int x) {
    while (i <= size) {
      bit[i] += x;
      i += i & (-i);
    }
  }
  int range(int l, int r) { return query(r) - query(l - 1); }
};
int n, k;
int p[500005], pinv[500005];
int pred[500005], succ[500005];
int prenum[500005], sucnum[500005];
int presum[500005], sucsum[500005];
int order[500005], ans[500005];
set<int> S;
BIT bit(500005);
int main(void) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> p[i];
  for (int i = 1; i <= n; i++) pinv[p[i]] = i;
  if (k == 1) {
    for (int i = 1; i <= n; i++) cout << i << " ";
    cout << endl;
    return 0;
  }
  k--;
  for (int i = 1; i <= k; i++) S.insert(p[i]);
  for (int i = 1; i <= n; i++) {
    if (i + k <= n) S.insert(p[i + k]);
    S.erase(p[i]);
    auto it = S.upper_bound(p[i]);
    if (it == S.begin()) continue;
    it--;
    pred[i] = pinv[*it];
  }
  S.clear();
  for (int i = n; i > n - k; i--) S.insert(p[i]);
  for (int i = n; i >= 1; i--) {
    if (i - k >= 1) S.insert(p[i - k]);
    S.erase(p[i]);
    auto it = S.upper_bound(p[i]);
    if (it == S.end()) continue;
    succ[i] = pinv[*it];
  }
  for (int j = 1; j <= n; j++) {
    int i = pinv[j];
    bit.add(i, 1);
    if (pred[i] != 0) prenum[i] = bit.range(i + 1, pred[i]);
    if (succ[i] != 0) sucnum[i] = (i - succ[i]) - bit.range(succ[i], i - 1);
  }
  for (int i = n; i >= 1; i--) {
    if (pred[i] != 0) presum[i] = presum[pred[i]] + prenum[i];
  }
  for (int i = 1; i <= n; i++) {
    if (succ[i] != 0) sucsum[i] = sucsum[succ[i]] + sucnum[i];
  }
  for (int i = 1; i <= n; i++) {
    order[i] += presum[i];
    order[i] += (i - 1) - sucsum[i];
    order[i] += 1;
  }
  for (int i = 1; i <= n; i++) ans[order[i]] = i;
  for (int i = 1; i <= n; i++) cout << ans[i] << endl;
  return 0;
}
