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;
const double PI = acos(-1.0);
const int INF = 1000 * 1000 * 1000 + 7;
const long long LINF = INF * (long long)INF;
const int MAX = 5 * 1000 * 100 + 47;
int P[MAX];
int ANS[MAX];
int M[MAX];
priority_queue<int> q;
struct RMQ {
  int T[MAX * 4];
  int n;
  int Max(int a, int b) { return P[a] > P[b] ? a : b; }
  void build(int v, int tl, int tr) {
    if (tl == tr) {
      T[v] = tl;
      return;
    }
    int tm = (tl + tr) / 2;
    build(2 * v, tl, tm);
    build(2 * v + 1, tm + 1, tr);
    T[v] = Max(T[2 * v], T[2 * v + 1]);
  }
  void init(int n) {
    this->n = n;
    build(1, 0, n - 1);
  }
  int get1(int v, int tl, int tr, int l, int r) {
    if (l > r) return n - 1;
    if (tl == l && tr == r) return T[v];
    int tm = (tl + tr) / 2;
    int v1 = get1(2 * v, tl, tm, l, min(r, tm));
    int v2 = get1(2 * v + 1, tm + 1, tr, max(l, tm + 1), r);
    return Max(v1, v2);
  }
  int get(int l, int r) { return get1(1, 0, n - 1, l, r); }
  void update(int v, int tl, int tr, int ind, int val) {
    if (tl == tr) {
      T[v] = tl;
      P[tl] = val;
      return;
    }
    int tm = (tl + tr) / 2;
    if (tm >= ind) {
      update(2 * v, tl, tm, ind, val);
    } else {
      update(2 * v + 1, tm + 1, tr, ind, val);
    }
    T[v] = Max(T[2 * v + 1], T[2 * v]);
  }
  void update(int ind, int val) { update(1, 0, n - 1, ind, val); }
} R;
int n, k;
void upd(int block) {
  int l = block * k;
  int r = min((block + 1) * k - 1, n - 1);
  int ind = R.get(l, r);
  if (ind == M[block] || ind == n) return;
  int v = R.get(max(ind - k + 1, 0), min(ind + k - 1, n - 1));
  if (v == ind) {
    q.push(ind);
    M[block] = ind;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = (0); i < (n); i++) {
    cin >> P[i];
    P[i]--;
  }
  P[n] = -INF;
  R.init(n + 1);
  int sz = (n + k - 1) / k;
  memset(M, -1, sizeof(M));
  for (int i = (0); i < (sz); i++) {
    upd(i);
  }
  int ind = n - 1;
  while (!q.empty()) {
    int pos = q.top();
    q.pop();
    ANS[pos] = ind;
    R.update(pos, -INF);
    int block = pos / k;
    upd(block);
    if (block) upd(block - 1);
    if (block + 1 != sz) upd(block + 1);
    ind--;
  }
  for (int i = (0); i < (n); i++) cout << ANS[i] + 1 << "\n";
}
