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>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
constexpr int MAXN = 500000;
struct treap {
  int pri, sz, val, lc, rc, par;
  void pull();
};
treap node[MAXN + 1];
void treap::pull() {
  sz = 1 + node[lc].sz + node[rc].sz;
  par = 0;
  node[lc].par = node[rc].par = this - node;
}
int N, K, a[MAXN + 1], root = 0;
int merge(int lc, int rc) {
  if (!lc || !rc) return lc + rc;
  if (node[lc].pri < node[rc].pri) {
    node[lc].rc = merge(node[lc].rc, rc);
    return node[lc].pull(), lc;
  } else {
    node[rc].lc = merge(lc, node[rc].lc);
    return node[rc].pull(), rc;
  }
}
void split(int o, int &lc, int &rc, int k) {
  if (!o) return lc = rc = 0, void();
  if (node[node[o].lc].sz < k) {
    lc = o;
    split(node[o].rc, node[lc].rc, rc, k - node[node[o].lc].sz - 1);
  } else {
    rc = o;
    split(node[o].lc, lc, node[rc].lc, k);
  }
  node[o].pull();
}
int pos(int val) {
  int o = root, sz;
  while (val != (sz = node[node[o].lc].sz + 1)) {
    if (val > sz)
      val -= sz, o = node[o].rc;
    else
      o = node[o].lc;
  }
  return node[o].val;
}
int at(int _pos) {
  int o = a[_pos], val = node[node[o].lc].sz + 1;
  while (node[o].par) {
    int tmp = o;
    o = node[o].par;
    if (node[o].rc == tmp) val += node[node[o].lc].sz + 1;
  }
  return val;
}
struct {
  int dt[MAXN + 1], N;
  void add(int x, int v) {
    while (x <= N) dt[x] += v, x += x & -x;
  }
  int qur(int x) {
    int v = 0;
    while (x > 0) v += dt[x], x -= x & -x;
    return v;
  }
  int qur(int l, int r) { return qur(r) - qur(l); }
} BIT;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  srand(2020);
  cin >> N >> K;
  BIT.N = N;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    node[a[i]].pri = rand();
    node[a[i]].sz = 1;
    node[a[i]].val = i;
    if (i >= 1 + K) BIT.add(a[i], 1);
  }
  for (int i = 1; i <= N; i++) root = merge(root, i);
  for (int i = 1; i <= N; i++) {
    int l = 0, ai = at(i), r = ai;
    while (l != r) {
      int m = (l + r) / 2;
      if (BIT.qur(ai - 1 - m, ai - 1) == m)
        l = m + 1;
      else
        r = m;
    }
    l -= 1;
    {
      int w, x, y, z;
      split(root, y, z, ai);
      split(y, x, y, ai - 1);
      split(x, w, x, ai - 1 - l);
      root = merge(merge(w, merge(y, x)), z);
      BIT.add(ai, 1), BIT.add(ai - l, -1);
    }
    ai -= l;
    if (ai >= 3 && pos(ai - 2) >= i + K) {
      int w, x, y, z;
      split(root, y, z, ai);
      split(y, x, y, ai - 2);
      split(x, w, x, ai - 3);
      root = merge(merge(w, merge(y, x)), z);
      BIT.add(ai, 1), BIT.add(ai - 2, -1);
    }
    if (i + K <= N) BIT.add(at(i + K), -1);
  }
  for (int i = 1; i <= N; i++) {
    cout << at(i) << '\n';
  }
  return 0;
}
