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;
pair<int, int> drzewo[4 * 100010];
bool czy[100010];
priority_queue<int> prl;
int n, k, r = 1;
int odp[100010];
pair<int, int> find_max(int gdzie, int pp, int pk, int zp, int zk) {
  if (zp > pk || zk < pp) return make_pair(0, -1);
  if (zp <= pp && zk >= pk) return drzewo[gdzie];
  int sr = (pp + pk) / 2;
  return max(find_max(2 * gdzie, pp, sr, zp, zk),
             find_max(2 * gdzie + 1, sr + 1, pk, zp, zk));
}
bool is_local_maximum(int x) {
  pair<int, int> a = find_max(1, 1, r, x - k + 1, x + k - 1);
  return a.first == drzewo[x + r - 1].first;
}
void inserty(int x) {
  drzewo[x].first = 0;
  x /= 2;
  while (x != 0) {
    drzewo[x] = max(drzewo[2 * x], drzewo[2 * x + 1]);
    x /= 2;
  }
}
pair<int, int> find_segment(int x) {
  return make_pair((x / k) * k, (x / k) * k + k - 1);
}
int main() {
  scanf("%d%d", &n, &k);
  while (r < n) r *= 2;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &drzewo[i + r].first);
    drzewo[i + r].second = i;
  }
  for (int i = n + r; i < 2 * r; ++i) drzewo[i] = make_pair(0, -1);
  for (int i = r - 1; i > 0; --i)
    drzewo[i] = max(drzewo[2 * i], drzewo[2 * i + 1]);
  for (int i = 0; i < n; ++i) {
    if (is_local_maximum(i + 1)) {
      prl.push(i);
      czy[i] = true;
    }
  }
  int wsk = n;
  while (!prl.empty()) {
    odp[prl.top()] = wsk;
    --wsk;
    inserty(prl.top() + r);
    pair<int, int> a = find_segment(prl.top());
    a.first++;
    a.second++;
    prl.pop();
    pair<int, int> b = find_max(1, 1, r, a.first, a.second);
    if (b.second != -1 && b.first != 0) {
      if (!czy[b.second] && is_local_maximum(b.second + 1)) {
        czy[b.second] = true;
        prl.push(b.second);
      }
    }
    b = find_max(1, 1, r, a.first - k, a.second - k);
    if (b.second != -1 && b.first != 0) {
      if (!czy[b.second] && is_local_maximum(b.second + 1)) {
        czy[b.second] = true;
        prl.push(b.second);
      }
    }
    b = find_max(1, 1, r, a.first + k, a.second + k);
    if (b.second != -1 && b.first != 0) {
      if (!czy[b.second] && is_local_maximum(b.second + 1)) {
        czy[b.second] = true;
        prl.push(b.second);
      }
    }
  }
  for (int i = 0; i < n; ++i) printf("%d\n", odp[i]);
  return 0;
}
