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>
const int maxn = 5e5 + 10;
inline int Max(int a, int b) { return a > b ? a : b; }
inline int Min(int a, int b) { return a > b ? b : a; }
namespace FastIO {
inline int read() {
  int f = 1, r = 0;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (isdigit(c)) {
    r = 10 * r + c - '0';
    c = getchar();
  }
  return f * r;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writesp(int x) { write(x), putchar(' '); }
inline void writeln(int x) { write(x), puts(""); }
};  // namespace FastIO
using namespace FastIO;
int N, seg[maxn << 2], pos[maxn], K, tot, ver[maxn << 2], next[maxn << 2],
    head[maxn], du[maxn];
std::vector<int> ans;
inline void add(int u, int v) {
  ver[++tot] = v, next[tot] = head[u], head[u] = tot;
}
void update(int l, int r, int pos, int val, int cur) {
  if (l == r) {
    seg[cur] = val;
    return;
  }
  if (((l + r) >> 1) >= pos)
    update(l, ((l + r) >> 1), pos, val, (cur << 1));
  else
    update(((l + r) >> 1) + 1, r, pos, val, (cur << 1 | 1));
  seg[cur] = Min(seg[(cur << 1)], seg[(cur << 1 | 1)]);
}
int query(int l, int r, int L, int R, int cur) {
  if (l >= L && r <= R) {
    return seg[cur];
  }
  int ans = 0x3f3f3f3f;
  if (((l + r) >> 1) >= L) {
    ans = query(l, ((l + r) >> 1), L, R, (cur << 1));
  }
  if (((l + r) >> 1) < R) {
    ans = Min(ans, query(((l + r) >> 1) + 1, r, L, R, (cur << 1 | 1)));
  }
  return ans;
}
std::priority_queue<int, std::vector<int>, std::greater<int>> q;
signed main() {
  N = read(), K = read();
  for (register int i = 1; i <= N; ++i) {
    pos[read()] = i;
  }
  memset(seg, 0x3f, sizeof(seg));
  for (register int i = N; i >= 1; --i) {
    int now = pos[i];
    int low = query(1, N, now, Min(N, now + K - 1), 1);
    if (low != 0x3f3f3f3f) {
      du[pos[low]]++, add(now, pos[low]);
    }
    low = query(1, N, Max(1, now - K + 1), now, 1);
    if (low != 0x3f3f3f3f) {
      du[pos[low]]++, add(now, pos[low]);
    }
    update(1, N, pos[i], i, 1);
  }
  for (register int i = 1; i <= N; ++i) {
    if (!du[i]) q.push(i);
  }
  while (!q.empty()) {
    int top = q.top();
    ans.push_back(top);
    q.pop();
    for (register int i = head[top]; i; i = next[i]) {
      du[ver[i]]--;
      if (du[ver[i]] == 0) {
        q.push(ver[i]);
      }
    }
  }
  for (register int i = 0; i < ans.size(); ++i) {
    writeln(ans[i]);
  }
  return 0;
}
