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 long double PI = 3.14159265359;
const long long MOD = (long long)1e6 + 7;
const long long MAXN = (long long)5e5 + 10;
const long long MAXK = (long long)1e2 + 10;
const long long INF = (long long)(1ll << 31);
const long double EPS = (long double)1e-8;
const long long LOG = (long long)22;
const int oo = 1000010;
int p[MAXN], a[MAXN], k, n;
vector<long long> sa;
int seg[4 * MAXN];
void update(int id, int val, int l, int r, int L, int R) {
  if (r <= L || l >= R) return;
  if (l <= L && R <= r) {
    seg[id] = val;
    return;
  }
  int mid = (L + R) >> 1;
  update(id << 1, val, l, r, L, mid);
  update(id << 1 | 1, val, l, r, mid, R);
  seg[id] = min(seg[id << 1], seg[id << 1 | 1]);
  return;
}
long long get_min(int id, int l, int r, int L, int R) {
  if (r <= L || l >= R) return INF;
  if (l <= L && R <= r) {
    return seg[id];
  }
  int mid = (L + R) >> 1;
  return min(get_min(id << 1, l, r, L, mid),
             get_min(id << 1 | 1, l, r, mid, R));
}
void rem(long long i) {
  if (a[i] == oo) return;
  sa.push_back(a[i]);
  update(1, oo, i, i + 1, 1, n + 1);
  a[i] = oo;
}
int last = 1;
void rem_while(long long x) {
  while (a[last] != x) rem(last++);
  rem(last++);
}
pair<long long, long long> solve(long long i) {
  long long mn, l = 1, bl = 0;
  while (l < i) {
    mn = get_min(1, l, i, 1, n + 1);
    if (mn == oo) {
      break;
    }
    if (a[i] + k <= mn) {
      break;
    }
    l = p[mn] + 1;
    bl = p[mn];
  }
  if (bl == 0) {
    rem(i);
    return {-INF, i};
  }
  return {bl + 1, i};
}
long long ans[MAXN], ind[MAXN];
void SORT(int l, int r) {
  if (r <= l) return;
  long long mn = get_min(1, l, r, 1, n + 1);
  if (mn == oo) return;
  pair<long long, long long> res = solve(p[mn]);
  if (res.first == -INF)
    return;
  else {
    SORT(l, res.second);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> p[i];
    a[p[i]] = i;
    ind[i] = i;
  }
  if (k > 2) {
    int fl;
    for (int i = 1; i <= n; i++) {
      fl = 0;
      for (int j = n - 1; j > 0; j--) {
        if (a[j] >= a[j + 1] + k) swap(a[j], a[j + 1]), fl = 1;
      }
      if (fl == 0) break;
    }
    for (int i = 1; i <= n; i++) ans[a[i]] = i;
    for (int i = 1; i <= n; i++) cout << ans[i] << '\n';
    return 0;
  }
  for (int i = 1; i <= n; i++) update(1, a[i], i, i + 1, 1, n + 1);
  for (int i = 1; i <= n; i++) SORT(1, n + 1);
  for (int i = 1; i <= n; i++) ans[sa[i - 1]] = i;
  for (int i = 1; i <= n; i++) cout << ans[i] << '\n';
  return 0;
}
