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 mxN = 500005;
int N, K, p[mxN], tr[mxN * 4];
void build(int v, int l, int r) {
  if (l == r) {
    tr[v] = l;
    return;
  }
  int m = (l + r) / 2;
  build(2 * v, l, m);
  build(2 * v + 1, m + 1, r);
  if (p[tr[2 * v]] > p[tr[2 * v + 1]])
    tr[v] = tr[2 * v];
  else
    tr[v] = tr[2 * v + 1];
}
void update(int v, int l, int r, int ind) {
  if (l == r) {
    p[l] = -1;
    return;
  }
  int m = (l + r) / 2;
  if (ind <= m)
    update(2 * v, l, m, ind);
  else
    update(2 * v + 1, m + 1, r, ind);
  if (p[tr[2 * v]] > p[tr[2 * v + 1]])
    tr[v] = tr[2 * v];
  else
    tr[v] = tr[2 * v + 1];
}
int query(int v, int s, int e, int l, int r) {
  if (l <= s && e <= r) return tr[v];
  int m = (s + e) / 2;
  if (r <= m) return query(2 * v, s, m, l, r);
  if (m + 1 <= l) return query(2 * v + 1, m + 1, e, l, r);
  int v1 = query(2 * v, s, m, l, r);
  int v2 = query(2 * v + 1, m + 1, e, l, r);
  if (p[v1] > p[v2]) return v1;
  return v2;
}
int getMax(int bk) {
  if (bk < 0 || bk * K >= N) return -1;
  int ind = query(1, 0, N - 1, bk * K, min(N - 1, bk * K + K - 1));
  int ind2 = query(1, 0, N - 1, max(0, ind - K + 1), min(N - 1, ind + K - 1));
  if (ind == ind2 && p[ind] != -1) return ind;
  return -1;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(32);
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    cin >> p[i];
    p[i]--;
  }
  build(1, 0, N - 1);
  priority_queue<int> pq;
  for (int i = 0; i < (N + K - 1) / K; i++) {
    int tmp = getMax(i);
    if (tmp != -1) pq.push(tmp);
  }
  vector<int> ans;
  while (!pq.empty()) {
    int y = pq.top();
    pq.pop();
    if (p[y] == -1) continue;
    ans.push_back(y);
    update(1, 0, N - 1, y);
    int bucket = y / K;
    int ind = getMax(bucket);
    if (ind != -1) pq.push(ind);
    ind = getMax(bucket - 1);
    if (ind != -1) pq.push(ind);
    ind = getMax(bucket + 1);
    if (ind != -1) pq.push(ind);
  }
  for (int i = N - 1; i >= 0; i--) {
    if (p[i] != -1) ans.push_back(i);
  }
  reverse(ans.begin(), ans.end());
  for (auto x : ans) {
    cout << x + 1 << '\n';
  }
  return 0;
}
