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 tp[505050], la[505050];
struct Node {
  Node *lch, *rch;
  int l, r;
  int ma;
} * rt;
int p[505050];
int t[505050];
int sn;
bool cmp(int x, int y) { return p[x] < p[y]; }
void work(int l, int r) {
  sn++;
  sort(t + l, t + r + 1, cmp);
  for (int i = l; i <= r; i++) {
    la[t[i]] = tp[sn];
    tp[sn] = t[i];
  }
}
void update(Node *x) { x->ma = max(x->lch->ma, x->rch->ma); }
Node *Build(int l, int r) {
  Node *ret = new Node;
  ret->l = l;
  ret->r = r;
  if (l == r) {
    ret->ma = p[l];
    ret->lch = ret->rch = NULL;
    return ret;
  }
  int mid = (l + r) >> 1;
  ret->lch = Build(l, mid);
  ret->rch = Build(mid + 1, r);
  update(ret);
  return ret;
}
void modify(Node *x, int p) {
  if (x->l == x->r) {
    x->ma = 0;
    return;
  }
  int mid = (x->l + x->r) >> 1;
  if (p <= mid)
    modify(x->lch, p);
  else
    modify(x->rch, p);
  update(x);
}
int query(Node *x, int l, int r) {
  if (l <= x->l && r >= x->r) return x->ma;
  int ret = 0, mid = (x->l + x->r) >> 1;
  if (l <= mid) ret = max(ret, query(x->lch, l, r));
  if (mid < r) ret = max(ret, query(x->rch, l, r));
  return ret;
}
int n, k;
bool jud(int x) {
  if (query(rt, max(x - k + 1, 1), min(x + k - 1, n)) == p[x]) return true;
  return false;
}
bool inq[505050];
int ans[505050];
int vv;
priority_queue<int> q;
int main() {
  int now, ss;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (int i = 1; i <= n; i++) t[i] = i;
  sn = 0;
  memset(tp, 0, sizeof(tp));
  for (int i = 1; i <= n; i += k) work(i, i + k - 1);
  memset(inq, 0, sizeof(inq));
  for (int i = 1; i <= sn; i++) {
    q.push(tp[i]);
    inq[tp[i]] = true;
  }
  rt = Build(1, n);
  inq[0] = true;
  vv = n;
  while (!q.empty()) {
    now = q.top();
    inq[now] = false;
    q.pop();
    if (jud(now)) {
      ans[now] = vv--;
      modify(rt, now);
      ss = (now + k - 1) / k;
      tp[ss] = la[tp[ss]];
      for (int i = ss - 1; i <= ss + 1; i++)
        if (!inq[tp[i]]) {
          q.push(tp[i]);
          inq[tp[i]] = true;
        }
    }
  }
  for (int i = 1; i <= n; i++) printf("%d\n", ans[i]);
  return 0;
}
