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 edge {
  int u, v;
  long long w;
};
int INF = INT_MAX / 2;
long long MOD = 1000000007;
long long _MOD = 1000000009;
double EPS = 1e-10;
struct segment_tree {
  int n;
  vector<pair<int, int> > v;
  segment_tree(int _n = 1) {
    for (n = 1; n < _n; n *= 2)
      ;
    v = vector<pair<int, int> >(n * 2 - 1, pair<int, int>(-1, -1));
  }
  void set(int i, int x) {
    int k = i + n - 1;
    v[k] = pair<int, int>(x, i);
    while (k > 0) {
      k = (k - 1) / 2;
      v[k] = max(v[k * 2 + 1], v[k * 2 + 2]);
    }
  }
  pair<int, int> _get(int i, int j, int k, int l, int r) {
    if (r <= i || j <= l) return pair<int, int>(-1, -1);
    if (i <= l && r <= j) return v[k];
    pair<int, int> vl = _get(i, j, k * 2 + 1, l, (l + r) / 2);
    pair<int, int> vr = _get(i, j, k * 2 + 2, (l + r) / 2, r);
    return max(vl, vr);
  }
  pair<int, int> get(int i, int j) { return _get(i, j, 0, 0, n); }
};
int N, K;
segment_tree st;
priority_queue<int> pq;
bool added[500000];
void f(int l) {
  int i = st.get(l, min(N, l + K)).second;
  if (i == -1) return;
  if (!added[i] && st.get(max(0, i - K + 1), min(N, i + K)).second == i)
    pq.push(i), added[i] = true;
}
int main() {
  cin >> N >> K;
  vector<int> a(N);
  for (int& x : a) scanf("%d", &x), x--;
  st = segment_tree(N);
  for (int i = 0; i < N; i++) st.set(i, a[i]);
  for (int l = 0; l < N; l += K) f(l);
  vector<int> ans(N);
  for (int t = N - 1; t >= 0; t--) {
    int i = pq.top();
    pq.pop();
    ans[i] = t;
    st.set(i, -1);
    int l = i / K;
    f(l * K);
    if (i - K >= 0) f((l - 1) * K);
    if (i + K < N) f((l + 1) * K);
  }
  for (int& x : ans) printf("%d\n", x + 1);
}
