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;
const int N = (int)5e5 + 100;
const int SZ = N;
int sz;
int l[SZ], r[SZ];
vector<int> g[SZ];
int degIn[SZ];
int addV(int v, int tl, int tr, int pos, int val) {
  42;
  if (tr == tl) return val;
  int nv = sz;
  l[nv] = l[v];
  r[nv] = r[v];
  sz++;
  int tm = (tl + tr) / 2;
  if (pos <= tm)
    l[nv] = addV(l[v], tl, tm, pos, val);
  else
    r[nv] = addV(r[v], tm + 1, tr, pos, val);
  for (int to : {l[nv], r[nv]})
    if (to != -1) {
      g[nv].push_back(to);
      degIn[to]++;
    }
  return nv;
}
void addEdges(int v, int tl, int tr, int sl, int sr, int from) {
  if (v == -1 || sr < tl || tr < sl) return;
  42;
  if (sl <= tl && tr <= sr) {
    g[from].push_back(v);
    degIn[v]++;
    return;
  }
  int tm = (tl + tr) / 2;
  addEdges(l[v], tl, tm, sl, sr, from);
  addEdges(r[v], tm + 1, tr, sl, sr, from);
}
int p[N], pos[N];
int pans[N];
int main(int, char **) {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &p[i]);
    p[i]--;
    pos[p[i]] = i;
  }
  sz = n;
  memset(l, -1, sizeof l);
  memset(r, -1, sizeof r);
  int a = 0, b = n - 1;
  while (b - a > 0) {
    for (int j = a; j <= b; j += 2) {
      g[sz].resize(2, -1);
      if (a != 0) {
        l[sz] = j;
        if (j + 1 <= b) r[sz] = j + 1;
      }
      for (int to : {l[sz], r[sz]})
        if (to != -1) {
          g[sz].push_back(to);
          degIn[to]++;
        }
      sz++;
    }
    a = b + 1;
    b = sz - 1;
  }
  int root = a;
  k--;
  for (int i = n - 1; i >= -k; i--) {
    if (i >= 0) {
      int j = p[i];
      root = addV(root, 0, n - 1, j, i);
    }
    if (k > 0 && i + k < n)
      addEdges(root, 0, n - 1, p[i + k] + 1, n - 1, i + k);
  }
  set<int> good;
  for (int i = 0; i < sz; i++)
    if (degIn[i] == 0) {
      good.insert(i);
    }
  vector<int> ans;
  while (!good.empty()) {
    int v = *good.rbegin();
    if (v < n) v = *good.begin();
    good.erase(v);
    if (v < n) {
      ans.push_back(v);
    }
    for (int to : g[v])
      if (to != -1) {
        degIn[to]--;
        if (degIn[to] == 0) {
          good.insert(to);
        }
      }
  }
  for (int i = 0; i < n; i++) pans[ans[i]] = i;
  for (int i = 0; i < n; i++) printf("%d ", pans[i] + 1);
  return 0;
}
