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 N, K, num;
int A[505050];
int T[2020202];
bool chk[505050];
int ans[505050];
void update(int id, int s, int e, int t) {
  if (e < t || t < s) return;
  if (s == e) {
    T[id] = t;
    return;
  }
  int mid = (s + e) / 2;
  update(id * 2, s, mid, t);
  update(id * 2 + 1, mid + 1, e, t);
  if (A[T[id * 2]] > A[T[id * 2 + 1]])
    T[id] = T[id * 2];
  else
    T[id] = T[id * 2 + 1];
}
int query(int id, int s, int e, int ts, int te) {
  if (e < ts || te < s) return N + 1;
  if (ts <= s && e <= te) return T[id];
  int mid = (s + e) / 2;
  int lret = query(id * 2, s, mid, ts, te);
  int rret = query(id * 2 + 1, mid + 1, e, ts, te);
  if (A[lret] > A[rret]) return lret;
  return rret;
}
priority_queue<int> PQ;
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", &A[i]);
    update(1, 0, N - 1, i);
  }
  for (int i = 0; i < N; i += K) {
    int k = query(1, 0, N - 1, i, min(N, i + K - 1));
    if (k == query(1, 0, N - 1, max(1, k - K + 1), min(N, k + K - 1))) {
      PQ.push(k);
      chk[k] = true;
    }
  }
  num = N;
  while (!PQ.empty()) {
    int t = PQ.top();
    PQ.pop();
    A[t] = 0;
    update(1, 0, N - 1, t);
    ans[t] = num--;
    int k = query(1, 0, N - 1, t / K * K, min(N - 1, (t / K + 1) * K - 1));
    if (A[k] && !chk[k] &&
        k == query(1, 0, N - 1, max(0, k - K + 1), min(N - 1, k + K - 1))) {
      PQ.push(k);
      chk[k] = true;
    }
    k = query(1, 0, N - 1, max(0, (t / K - 1) * K), max(0, t / K * K - 1));
    if (A[k] && !chk[k] &&
        k == query(1, 0, N - 1, max(0, k - K + 1), min(N - 1, k + K - 1))) {
      PQ.push(k);
      chk[k] = true;
    }
    k = query(1, 0, N - 1, min(N, (t / K + 1) * K),
              min(N - 1, (t / K + 2) * K - 1));
    if (A[k] && !chk[k] &&
        k == query(1, 0, N - 1, max(0, k - K + 1), min(N - 1, k + K - 1))) {
      PQ.push(k);
      chk[k] = true;
    }
  }
  for (int i = 0; i < N; i++) printf("%d\n", ans[i]);
  return 0;
}
