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 n, m, i, j, a[500005], p[500005], ans[500005], cnt, vis[500005];
struct ii {
  int mi, id;
} s[2000005];
ii mrg(ii x, ii y) { return x.mi < y.mi ? x : y; }
void update(int x, int l, int r, int y, ii c) {
  if (l == r) {
    s[x] = c;
    return;
  }
  int mid = (l + r) / 2;
  if (y <= mid) {
    update(x + x, l, mid, y, c);
  } else {
    update(x + x + 1, mid + 1, r, y, c);
  }
  s[x] = mrg(s[x + x], s[x + x + 1]);
}
ii query(int x, int l, int r, int ql, int qr) {
  if (ql > qr) {
    return (ii){0x3f3f3f3f, -1};
  }
  if (ql <= l && r <= qr) {
    return s[x];
  }
  int mid = (l + r) / 2;
  if (qr <= mid) {
    return query(x + x, l, mid, ql, qr);
  }
  if (ql > mid) {
    return query(x + x + 1, mid + 1, r, ql, qr);
  }
  return mrg(query(x + x, l, mid, ql, qr),
             query(x + x + 1, mid + 1, r, ql, qr));
}
vector<int> bi[500005];
int deg[500005];
void add(int x, int y) {
  bi[x].push_back(y);
  deg[y]++;
}
int main() {
  scanf("%d%d", &n, &m);
  for ((i) = 1; (i) <= (n); (i)++) {
    scanf("%d", &a[i]);
    p[a[i]] = i;
  }
  for ((i) = 1; (i) <= (n); (i)++) {
    update(1, 1, n, i, (ii){0x3f3f3f3f, -1});
  }
  for ((i) = (n); (i) >= 1; (i)--) {
    ii t = query(1, 1, n, max(1, p[i] - m + 1), p[i] - 1);
    if (t.id != -1) {
      add(p[i], p[t.id]);
    }
    t = query(1, 1, n, p[i] + 1, min(n, p[i] + m - 1));
    if (t.id != -1) {
      add(p[i], p[t.id]);
    }
    update(1, 1, n, p[i], (ii){i, i});
  }
  priority_queue<int, vector<int>, greater<int> > pq;
  for ((i) = 1; (i) <= (n); (i)++) {
    if (!deg[i]) {
      deg[i] = -1;
      pq.push(i);
    }
  }
  while (!pq.empty()) {
    int x = pq.top();
    pq.pop();
    deg[x] = -1;
    ans[++cnt] = x;
    for (__typeof((bi[x]).begin()) it = (bi[x]).begin(); it != (bi[x]).end();
         it++) {
      if (!--deg[*it]) {
        pq.push(*it);
      }
    }
  }
  for ((i) = 1; (i) <= (n); (i)++) {
    printf("%d\n", ans[i]);
  }
  return 0;
}
