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 EPS = (long double)1e-7;
const long double PI = acos(0) * 2;
bool isZero(const long double& x) { return abs(x) <= EPS; }
int sign(const long double& x) { return isZero(x) ? 0 : (0 < x ? 1 : -1); }
long long gcd(long long a, long long b) {
  for (; b; a %= b, swap(a, b)) {
  }
  return abs(a);
}
pair<long long, long long> operator+(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return pair<long long, long long>(a.first + b.first, a.second + b.second);
}
pair<long long, long long> operator-(const pair<long long, long long>& a,
                                     const pair<long long, long long>& b) {
  return pair<long long, long long>(a.first - b.first, a.second - b.second);
}
pair<long long, long long> operator*(const pair<long long, long long>& a,
                                     const long long& b) {
  return pair<long long, long long>(a.first * b, a.second * b);
}
long long operator*(const pair<long long, long long>& a,
                    const pair<long long, long long>& b) {
  return a.first * b.second - b.first * a.second;
}
long long ccw(const pair<long long, long long>& a,
              const pair<long long, long long>& b,
              const pair<long long, long long>& c) {
  return a * b + b * c + c * a;
}
void fg(vector<int> G[], int a, int b) {
  G[a].push_back(b);
  G[b].push_back(a);
}
void fg(vector<pair<int, int>> G[], int a, int b, int c) {
  G[a].push_back({b, c});
  G[b].push_back({a, c});
}
const int MAXN = 500005;
const int MX = 1 << 19;
struct SEG {
  SEG() { init(); }
  int d[MX * 2];
  void init() { fill(d, d + MX * 2, (0x3f3f3f3f)); }
  void upd(int i, int r) {
    d[i + MX] = r;
    for (i = (i + MX) / 2; i; i >>= 1) d[i] = min(d[i * 2], d[i * 2 + 1]);
  }
  int get(int s, int e) {
    int r = (0x3f3f3f3f);
    for (s += MX, e += MX; s <= e; s /= 2, e /= 2) {
      if (s & 1) {
        (r) = min((r), (d[s]));
        s++;
      }
      if (~e & 1) {
        (r) = min((r), (d[e]));
        e--;
      }
    }
    return r;
  }
};
SEG seg;
vector<int> G[MAXN], RG[MAXN];
priority_queue<int, vector<int>, greater<int>> PQ;
int OD[MAXN];
int A[MAXN], B[MAXN];
bool chk[MAXN];
vector<int> AnsV;
int Ans[MAXN];
int N, K;
void f(int x, int cuti) {
  if (chk[B[x]]) return;
  chk[B[x]] = true;
  vector<int> V;
  for (int i;;) {
    i = seg.get(B[x] - K, B[x] + K);
    if (i >= x || i < cuti) break;
    V.push_back(i);
    seg.upd(B[i], (0x3f3f3f3f));
  }
  if (V.empty()) return;
  for (int v : V) G[B[x]].push_back(B[v]);
  for (int i = 1; i < ((int)(V).size()); i++) {
    int a = V[i - 1], b = V[i];
    if (abs(B[a] - B[b]) > K) continue;
    G[B[b]].push_back(B[a]);
  }
  f(V[0], cuti);
  for (int i = 1; i < ((int)(V).size()); i++) f(V[i], V[i - 1] + 1);
}
int main() {
  ios::sync_with_stdio(false);
  cin >> N >> K;
  K--;
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    B[A[i]] = i;
  }
  for (int i = 1; i <= N; i++) {
    seg.upd(B[i], i);
  }
  for (int i = 1; i <= N; i++)
    if (!chk[i]) {
      f(A[i], 1);
    }
  for (int i = 1; i <= N; i++) {
    for (int v : G[i]) RG[v].push_back(i);
    if (!(OD[i] = ((int)(G[i]).size()))) {
      PQ.push(i);
    }
  }
  for (; !PQ.empty();) {
    int x = PQ.top();
    PQ.pop();
    AnsV.push_back(x);
    for (int v : RG[x])
      if (!(--OD[v])) PQ.push(v);
  }
  for (int i = 0; i < N; i++) Ans[AnsV[i]] = i + 1;
  for (int i = 1; i <= N; i++) printf("%d\n", Ans[i]);
  return 0;
}
