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;
template <class T, class T2>
inline void chkmax(T &x, const T2 &y) {
  if (x < y) x = y;
}
template <class T, class T2>
inline void chkmin(T &x, const T2 &y) {
  if (x > y) x = y;
}
const int MAXN = (1 << 20);
random_device rd;
mt19937 mt(rd());
struct node {
  int prior, val, mn, sz;
  node *l, *r, *par;
  node() {
    prior = val = mn = sz = 0;
    par = l = r = nullptr;
  }
  node(int v) {
    prior = mt();
    val = mn = v;
    sz = 1;
    par = l = r = nullptr;
  }
};
typedef node *pnode;
int size(pnode t) { return t ? t->sz : 0; }
void update_size(pnode &t) {
  if (t) t->sz = size(t->l) + size(t->r) + 1;
}
void reset(pnode &t) {
  if (t) t->mn = t->val;
}
void update_par(pnode &t) {
  if (!t) return;
  if (t->l) t->l->par = t;
  if (t->r) t->r->par = t;
  t->par = nullptr;
}
void combine(pnode &t, pnode l, pnode r) {
  if (!l) {
    t = r;
    return;
  }
  if (!r) {
    t = l;
    return;
  }
  t->mn = min(l->mn, r->mn);
}
void operation(pnode &t) {
  if (!t) return;
  reset(t);
  combine(t, t->l, t);
  combine(t, t, t->r);
}
void merge(pnode &t, pnode l, pnode r) {
  if (!l) {
    t = r;
    return;
  }
  if (!r) {
    t = l;
    return;
  }
  if (l->prior > r->prior)
    merge(l->r, l->r, r), t = l;
  else
    merge(r->l, l, r->l), t = r;
  update_par(t);
  update_size(t);
  operation(t);
}
void split(pnode t, pnode &l, pnode &r, int k, int add = 0) {
  if (!t) {
    l = r = nullptr;
    return;
  }
  int idx = add + size(t->l);
  if (idx <= k)
    split(t->r, t->r, r, k, idx + 1), l = t;
  else
    split(t->l, l, t->l, k, add), r = t;
  update_par(t);
  update_size(t);
  operation(t);
}
int get_pos(pnode it) {
  if (!it) return -1;
  pnode u = it;
  int answer = size(it->l);
  while (true) {
    if (!u->par) break;
    if (u->par->r == u) answer += size(u->par->l) + 1;
    u = u->par;
  }
  return answer;
}
int find_leftmost(pnode it, int v) {
  if (!it) return 0;
  int MN = it->val;
  if (it->r) chkmin(MN, it->r->mn);
  if (MN < v)
    return size(it->l) + 1 + find_leftmost(it->r, v);
  else
    return find_leftmost(it->l, v);
}
int n, k;
int a[MAXN], p[MAXN];
void read() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> p[i];
}
pnode root, pin[MAXN];
int answer[MAXN];
void dfs(pnode t, int add = 0) {
  if (!t) return;
  dfs(t->l, add);
  dfs(t->r, add + size(t->l) + 1);
  answer[size(t->l) + add] = t->val;
}
void solve() {
  for (int i = 1; i <= n; i++) a[p[i]] = i;
  root = nullptr;
  for (int i = 1; i <= n; i++) {
    pnode curr = new node(a[i]);
    pin[a[i]] = curr;
    merge(root, root, curr);
  }
  for (int i = 0; i < 20; i++) {
    for (int v = n; v >= 1; v--) {
      int po = get_pos(pin[v]);
      pnode L, R, curr;
      split(root, L, R, po - 1);
      split(R, curr, R, 0);
      int new_pos = find_leftmost(L, v + k);
      split(L, L, root, new_pos - 1);
      merge(L, L, curr);
      merge(L, L, root);
      merge(root, L, R);
    }
    for (int v = 1; v <= n; v++) {
      int po = get_pos(pin[v]);
      pnode L, R, curr;
      split(root, L, R, po - 1);
      split(R, curr, R, 0);
      int new_pos = find_leftmost(L, v + k);
      split(L, L, root, new_pos - 1);
      merge(L, L, curr);
      merge(L, L, root);
      merge(root, L, R);
    }
  }
  dfs(root);
  for (int i = 0; i < n; i++) cout << answer[i] << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  read();
  solve();
  return 0;
}
