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 QueryAns, N, K, answer[500009], P[500009], arr[500009], aint[2000017];
bool in_q[500009];
priority_queue<int> PQ;
void Update(int nod, int st, int dr, int pos, int val) {
  if (st == dr) {
    arr[pos] = val, aint[nod] = pos;
    return;
  }
  int mij = (st + dr) >> 1, f1 = nod << 1, f2 = f1 | 1;
  if (pos <= mij)
    Update(f1, st, mij, pos, val);
  else
    Update(f2, mij + 1, dr, pos, val);
  int p1 = aint[f1], p2 = aint[f2];
  if (arr[p1] > arr[p2])
    aint[nod] = p1;
  else
    aint[nod] = p2;
}
void Query(int nod, int st, int dr, int x, int y) {
  if (x <= st && dr <= y) {
    if (x == st)
      QueryAns = aint[nod];
    else if (arr[aint[nod]] > arr[QueryAns])
      QueryAns = aint[nod];
    return;
  }
  int mij = (st + dr) >> 1, f1 = nod << 1, f2 = f1 | 1;
  if (x <= mij) Query(f1, st, mij, x, y);
  if (mij < y) Query(f2, mij + 1, dr, x, y);
}
void Refresh(int i) {
  int st = max(i * K, 1), dr = min((i + 1) * K - 1, N);
  if (st > dr) return;
  Query(1, 1, N, st, dr);
  int pos = QueryAns;
  if (in_q[pos]) return;
  st = max(pos - K + 1, 1), dr = min(pos + K - 1, N);
  Query(1, 1, N, st, dr);
  if (pos == QueryAns) {
    in_q[pos] = 1;
    PQ.push(pos);
  }
}
int main() {
  scanf("%d %d", &N, &K);
  for (int i = 1; i <= N; i++) scanf("%d", &P[i]);
  for (int i = 1; i <= N; i++) Update(1, 1, N, i, P[i]);
  for (int i = 0; i * K <= N; i++) Refresh(i);
  for (int curr_pos = N; curr_pos >= 1; curr_pos--) {
    int val = PQ.top();
    PQ.pop();
    answer[curr_pos] = val;
    Update(1, 1, N, val, 0);
    Refresh(val / K - 1), Refresh(val / K), Refresh(val / K + 1);
  }
  for (int i = 1; i <= N; i++) printf("%d\n", answer[i]);
  return 0;
}
