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 long mod = 1000000007;
const long long inf = mod * mod;
const long long d2 = (mod + 1) / 2;
const double EPS = 1e-11;
const double INF = 1e+10;
const double PI = acos(-1.0);
const int C_SIZE = 3100000;
const int UF_SIZE = 3100000;
namespace {
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
inline long long Comb(int a, int b) {
  if (a < b || b < 0) return 0;
  return fact[a] * finv[b] % mod * finv[a - b] % mod;
}
void init_C(int n) {
  fact[0] = finv[0] = inv[1] = 1;
  for (int i = 2; i < n; i++) {
    inv[i] = (mod - (mod / i) * inv[mod % i] % mod) % mod;
  }
  for (int i = 1; i < n; i++) {
    fact[i] = fact[i - 1] * i % mod;
    finv[i] = finv[i - 1] * inv[i] % mod;
  }
}
long long pw(long long a, long long b) {
  if (a < 0LL) return 0;
  if (b < 0LL) return 0;
  long long ret = 1;
  while (b) {
    if (b % 2) ret = ret * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return ret;
}
long long pw_mod(long long a, long long b, long long M) {
  if (a < 0LL) return 0;
  if (b < 0LL) return 0;
  long long ret = 1;
  while (b) {
    if (b % 2) ret = ret * a % M;
    a = a * a % M;
    b /= 2;
  }
  return ret;
}
int pw_mod_int(int a, int b, int M) {
  if (a < 0) return 0;
  if (b < 0) return 0;
  int ret = 1;
  while (b) {
    if (b % 2) ret = (long long)ret * a % M;
    a = (long long)a * a % M;
    b /= 2;
  }
  return ret;
}
int ABS(int a) { return max(a, -a); }
long long ABS(long long a) { return max(a, -a); }
double ABS(double a) { return max(a, -a); }
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
int UF[UF_SIZE];
void init_UF(int n) {
  for (int i = 0; i < n; i++) UF[i] = -1;
}
int FIND(int a) {
  if (UF[a] < 0) return a;
  return UF[a] = FIND(UF[a]);
}
void UNION(int a, int b) {
  a = FIND(a);
  b = FIND(b);
  if (a == b) return;
  if (UF[a] > UF[b]) swap(a, b);
  UF[a] += UF[b];
  UF[b] = a;
}
}  // namespace
int segtree[1 << 20];
int query(int a, int b, int c, int d, int e, int f) {
  if (d < a || b < c) {
    return -1;
  }
  if (c <= a && b <= d) {
    return f;
  }
  return max(
      query(a, (a + b) / 2, c, d, e * 2, f + segtree[e * 2]),
      query((a + b) / 2 + 1, b, c, d, e * 2 + 1, f + segtree[e * 2 + 1]));
}
void add(int a, int b, int c, int d, int e, int f) {
  if (d < a || b < c) return;
  if (c <= a && b <= d) {
    segtree[e] += f;
  } else {
    add(a, (a + b) / 2, c, d, e * 2, f);
    add((a + b) / 2 + 1, b, c, d, e * 2 + 1, f);
    int t = max(segtree[e * 2], segtree[e * 2 + 1]);
    segtree[e] += t;
    segtree[e * 2] -= t;
    segtree[e * 2 + 1] -= t;
  }
}
int segtree2[1 << 20];
int f(int a, int b, int c, int d) {
  if (a == b) return a;
  if (segtree2[c * 2] > d) {
    return f(a, (a + b) / 2, c * 2, d);
  } else {
    return f((a + b) / 2 + 1, b, c * 2 + 1, d - segtree2[c * 2]);
  }
}
void del(int a) {
  a += 524288;
  while (a) {
    segtree2[a]--;
    a /= 2;
  }
}
int p[510000];
int q[510000];
int ret[510000];
int tmp[510000];
int ans[510000];
int main() {
  int a, b;
  scanf("%d%d", &a, &b);
  for (int i = 0; i < a; i++) {
    scanf("%d", p + i);
    p[i]--;
  }
  for (int i = 0; i < a; i++) q[p[i]] = i;
  segtree[1] = -1;
  for (int i = 0; i < a; i++) {
    int at = query(0, 524287, 0, q[i] + b - 1, 1, segtree[1]) + 1;
    tmp[i] = at;
    add(0, 524287, q[i], q[i], 1,
        at - query(0, 524287, q[i], q[i], 1, segtree[1]));
    add(0, 524287, q[i] + 1, 524287, 1, 1);
  }
  for (int i = 0; i < a; i++) {
    segtree2[524288 + i] = 1;
  }
  for (int i = 524287; i > 0; i--) {
    segtree2[i] = segtree2[i * 2] + segtree2[i * 2 + 1];
  }
  for (int i = a - 1; i >= 0; i--) {
    ret[q[i]] = f(0, 524287, 1, tmp[i]);
    del(ret[q[i]]);
  }
  for (int i = 0; i < a; i++) {
    ans[ret[i]] = i;
  }
  for (int i = 0; i < a; i++) {
    printf("%d\n", ans[i] + 1);
  }
}
