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>
#pragma warning(disable : 4996)
using namespace std;
const int maxn = 500005;
const long long mod = 998244353;
const double PI = acos(-1.0);
struct no {
  int le;
  int ri;
  int max_v;
} node[4 * maxn];
void build(int root, int le, int ri, int v) {
  if (le == ri) {
    node[root].le = le;
    node[root].ri = ri;
    node[root].max_v = v;
    return;
  }
  int mid = (le + ri) >> 1;
  build(root << 1, le, mid, v);
  build((root << 1) | 1, mid + 1, ri, v);
  node[root].le = le;
  node[root].ri = ri;
  node[root].max_v = v;
}
int query(int root, int le, int ri) {
  if (node[root].le == le && node[root].ri == ri) {
    return node[root].max_v;
  }
  int mid = (node[root].le + node[root].ri) >> 1;
  if (mid >= ri) {
    return query(root << 1, le, ri);
  } else if (mid + 1 <= le) {
    return query(root << 1 | 1, le, ri);
  } else {
    return max(query(root << 1, le, mid), query(root << 1 | 1, mid + 1, ri));
  }
}
void update(int root, int k, int v) {
  if (node[root].le == k && node[root].ri == k) {
    node[root].max_v = v;
    return;
  }
  int mid = (node[root].le + node[root].ri) >> 1;
  if (k <= mid) {
    update(root << 1, k, v);
  } else {
    update(root << 1 | 1, k, v);
  }
  node[root].max_v = max(node[root << 1].max_v, node[root << 1 | 1].max_v);
}
int n, k;
int pos[maxn], out[maxn], res[maxn];
vector<int> ed[maxn];
priority_queue<int> que;
void solve() {
  int i, j, m;
  scanf("%d", &(n)), scanf("%d", &(k));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &(m));
    pos[m] = i;
  }
  build(1, 1, n, -0x3f3f3f3f);
  for (int i = 1; i <= n; i++) {
    m = query(1, pos[i], min(n, pos[i] + k - 1));
    if (m != -0x3f3f3f3f) {
      int x = -m;
      out[x]++;
      ed[pos[i]].push_back(x);
    }
    update(1, pos[i], -pos[i]);
  }
  build(1, 1, n, -0x3f3f3f3f);
  for (i = n; i >= 1; i--) {
    m = query(1, pos[i], min(n, pos[i] + k - 1));
    if (m != -0x3f3f3f3f) {
      int x = -m;
      out[pos[i]]++;
      ed[x].push_back(pos[i]);
    }
    update(1, pos[i], -pos[i]);
  }
  for (int i = 1; i <= n; i++) {
    if (out[i] == 0) {
      que.push(i);
    }
  }
  for (i = n; i >= 1; i--) {
    int v = que.top();
    que.pop();
    res[v] = i;
    for (int j = 0; j < ed[v].size(); j++) {
      out[ed[v][j]]--;
      if (out[ed[v][j]] <= 0) {
        que.push(ed[v][j]);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    printf("%d\n", res[i]);
  }
}
int main() {
  solve();
  return 0;
}
