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 long long INF = 1000 * 1000 * 1000 + 7;
const long long LINF = INF * (long long)INF;
const int MAX = 500500;
int P[MAX];
int Q[MAX];
struct RMQ {
  int A[MAX * 4];
  int n;
  void init(int n) { this->n = n; }
  void add(int tl, int tr, int v, int x, int val) {
    if (tl == tr) {
      A[v] = val;
      return;
    }
    int tm = (tl + tr) / 2;
    if (x <= tm)
      add(tl, tm, v * 2, x, val);
    else
      add(tm + 1, tr, v * 2 + 1, x, val);
    A[v] = max(A[v * 2], A[v * 2 + 1]);
  }
  void add(int x, int val) { add(0, n - 1, 1, x, val); }
  int get(int tl, int tr, int v, int l, int r) {
    if (l > r) return -INF;
    if (l == tl && r == tr) {
      return A[v];
    }
    int tm = (tl + tr) / 2;
    int res = get(tl, tm, v * 2, l, min(tm, r));
    res = max(res, get(tm + 1, tr, v * 2 + 1, max(tm + 1, l), r));
    return res;
  }
  int get(int l, int r) { return get(0, n - 1, 1, l, r); }
} R;
int n, k;
bool isMax(int pos) {
  int l = max(0, pos - k + 1);
  int r = min(n - 1, pos + k - 1);
  int mx = R.get(l, r);
  if (mx == P[pos]) return true;
  return false;
}
set<int> S;
void upd(int ind) {
  int l = ind * k;
  int r = min(n - 1, (ind + 1) * k - 1);
  int val = R.get(l, r);
  if (val == -INF) return;
  int pos = Q[val];
  if (isMax(pos)) {
    S.insert(pos);
  }
}
int main() {
  scanf("%d%d", &n, &k);
  R.init(n);
  for (int i = (0); i < (n); i++) {
    scanf("%d", &P[i]);
    P[i]--;
    Q[P[i]] = i;
    R.add(i, P[i]);
  }
  for (int i = (0); i < ((n + k - 1) / k); i++) {
    upd(i);
  }
  vector<int> res;
  while ((int)res.size() < n) {
    if (S.empty()) throw -1;
    int pos = *S.rbegin();
    S.erase(pos);
    if (!isMax(pos)) continue;
    res.push_back(pos);
    R.add(pos, -INF);
    int ind = pos / k;
    upd(ind);
    if (ind) upd(ind - 1);
    if (ind < (n + k - 1) / k - 1) upd(ind + 1);
  }
  reverse(res.begin(), res.end());
  for (int i = (0); i < ((int)res.size()); i++) {
    printf("%d\n", res[i] + 1);
  }
  printf("\n");
}
