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;
using ll = long long;
using ull = unsigned long long;
constexpr int TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
struct Node {
  using NP = Node*;
  int ma;
  int get(int a, int b) {
    if (b <= 0 or sz <= a) return -1;
    if (a <= 0 and sz <= b) {
      return ma;
    }
    return max(l->get(a, b), r->get(a - sz / 2, b - sz / 2));
  }
  NP l, r;
  int sz;
  Node(int sz, int d[]) : sz(sz) {
    if (sz == 1) {
      ma = d[0];
      return;
    }
    l = new Node(sz / 2, d);
    r = new Node(sz - sz / 2, d + sz / 2);
    ma = max(l->ma, r->ma);
  }
};
struct UnionFind {
  vector<int> ig;
  vector<vector<int>> gi;
  int gn;
  vector<int> mi;
  UnionFind(int N) {
    ig.resize(N);
    gi.resize(N);
    mi.resize(N);
    for (int i = 0; i < N; i++) {
      ig[i] = i;
      gi[i] = {i};
      mi[i] = i;
    }
    gn = N;
  }
  void merge(int a, int b) {
    if (same(a, b)) return;
    gn--;
    int x = ig[a], y = ig[b];
    if (gi[x].size() < gi[y].size()) swap(x, y);
    for (int j : gi[y]) {
      ig[j] = x;
    }
    gi[x].insert(gi[x].end(), gi[y].begin(), gi[y].end());
    gi[y].clear();
    mi[x] = max(mi[x], mi[y]);
  }
  bool same(int a, int b) { return ig[a] == ig[b]; }
  int get(int x) { return mi[ig[x]]; }
};
int main() {
  int n, k;
  cin >> n >> k;
  int p[n], q[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
    p[i]--;
  }
  for (int i = 0; i < n; i++) {
    q[p[i]] = i;
  }
  Node* rmq = new Node(n, p);
  UnionFind uf = UnionFind(n + 1);
  int rt[n];
  for (int i = 0; i < n; i++) {
    int u = rmq->get(max(0, i - k + 1), min(n, i + k));
    if (u == -1) {
      u = n;
    }
    int v = uf.get(u);
    if (v == n) v = -1;
    rt[i] = q[v];
    uf.merge(q[i], u);
  }
  int nx[n];
  fill_n(nx, n, -1);
  for (int i = 0; i < n; i++) {
    nx[rt[i]] = i;
  }
  int s = n;
  while (true) {
    s = nx[s];
    if (s == -1) break;
    printf("%d\n", s + 1);
  }
  return 0;
}
