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 = 5e5 + 5, mod = 0;
int n;
struct segtree {
  int sum[N << 2];
  segtree() { memset(sum, 0, sizeof sum); }
  void update(int pos, int x, int v = 1, int b = 0, int e = n) {
    if (b + 1 == e) {
      sum[v] = x;
      return;
    }
    int m = b + e >> 1, l = v << 1, r = l | 1;
    if (pos < m)
      update(pos, x, l, b, m);
    else
      update(pos, x, r, m, e);
    sum[v] = sum[l] + sum[r];
  }
  int find_right(int pos, int v = 1, int b = 0, int e = n) {
    if (pos <= b || sum[v] == e - b) return -1;
    if (b + 1 == e) return b;
    int m = b + e >> 1, l = v << 1, r = l | 1;
    int ansr = find_right(pos, r, m, e);
    if (ansr != -1) return ansr;
    return find_right(pos, l, b, m);
  }
  int get(int x, int v = 1, int b = 0, int e = n) {
    if (x < b) return 0;
    if (e <= x + 1) return sum[v];
    int m = b + e >> 1, l = v << 1, r = l | 1;
    return get(x, l, b, m) + get(x, r, m, e);
  }
  int find_left(int x, int cur = 0, int v = 1, int b = 0, int e = n) {
    if (cur + sum[v] <= x) return n;
    if (b + 1 == e) return b;
    int m = b + e >> 1, l = v << 1, r = l | 1;
    int ansl = find_left(x, cur, l, b, m);
    if (ansl != n) return ansl;
    return find_left(x, cur + sum[l], r, m, e);
  }
};
segtree used, act, rem;
int p[N], res[N], k, pos[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
    p[i]--;
    pos[p[i]] = i;
  }
  for (int j = 0; j < 25; ++j)
    for (int i = 0; i < n - 1; ++i)
      if (pos[i] >= pos[i + 1] && abs(pos[i] - pos[i + 1]) >= k) {
        swap(p[pos[i]], p[pos[i + 1]]), swap(pos[i], pos[i + 1]);
      }
  for (int i = 0; i < n; ++i) {
    used.update(i, 1);
    rem.update(i, 1);
    if (i >= k) act.update(p[i], 1);
  }
  for (int i = 0; i < n - k; ++i) {
    int x = p[i];
    x = rem.get(x) - 1;
    x = used.find_left(x);
    int put = act.find_right(x) + 1;
    act.update(x, 1);
    act.update(put, 0);
    rem.update(x, 0);
    res[i] = put;
    used.update(put, 0);
    int j = i + k;
    int a = p[j];
    a = rem.get(a) - 1;
    a = used.find_left(a);
    act.update(a, 0);
  }
  for (int i = n - k; i < n; ++i) {
    int x = p[i];
    x = rem.get(x) - 1;
    x = used.find_left(x);
    res[i] = x;
  }
  for (int i = 0; i < n; ++i) cout << res[i] + 1 << '\n';
}
