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>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
constexpr int MAXN = 500000, INF = 1e8;
pair<int, int> st[MAXN * 4];
int N, K, a[MAXN + 1];
void modify(int x, int v, int l, int r, int o) {
  if (l == r) {
    st[o] = make_pair(v, x);
  } else {
    int m = (l + r) / 2;
    if (x <= m)
      modify(x, v, l, m, o * 2);
    else
      modify(x, v, m + 1, r, o * 2 + 1);
    st[o] = max(st[o * 2], st[o * 2 + 1]);
  }
}
void modify(int x, int v) { modify(x, v, 1, N, 1); }
pair<int, int> query(int ql, int qr, int l, int r, int o) {
  if (ql == l && qr == r) {
    return st[o];
  } else {
    int m = (l + r) / 2;
    if (qr <= m) return query(ql, qr, l, m, o * 2);
    if (ql > m) return query(ql, qr, m + 1, r, o * 2 + 1);
    return max(query(ql, m, l, m, o * 2),
               query(m + 1, qr, m + 1, r, o * 2 + 1));
  }
}
pair<int, int> query(int ql, int qr) {
  ql = max(ql, 1);
  qr = min(qr, N);
  if (ql > qr) return {-INF, -INF};
  return query(ql, qr, 1, N, 1);
}
bool test_max(int x) { return x == query(x - K + 1, x + K - 1).second; }
priority_queue<int> pq;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> N >> K;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    modify(i, a[i]);
  }
  for (int i = 1; i <= N; i += K) {
    auto p = query(i, i + K - 1);
    if (p.first != -INF && test_max(p.second)) {
      pq.push(p.second);
    }
  }
  vector<int> vout;
  while (!pq.empty()) {
    int x = pq.top();
    pq.pop();
    if (a[x] == -INF) continue;
    vout.push_back(x);
    modify(x, -INF);
    a[x] = -INF;
    x = (x - 1) / K * K + 1;
    for (int i = -1; i <= 1; i++) {
      auto p = query(x + i * K, x + i * K + K - 1);
      if (p.first != -INF && test_max(p.second)) {
        pq.push(p.second);
      }
    }
  }
  copy(vout.rbegin(), vout.rend(), ostream_iterator<int>(cout, "\n"));
  return 0;
}
