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 N = 500010;
const int INF = 1e9;
int seg[N << 2];
int p[N], mp[N];
int in[N];
vector<int> vec[N];
int n, K;
priority_queue<int> q;
void update(int node) { seg[node] = min(seg[node << 1], seg[node << 1 | 1]); }
void build(int node, int l, int r) {
  if (l == r) {
    seg[node] = INF;
    return;
  }
  int mid = l + r >> 1;
  build(node << 1, l, mid);
  build(node << 1 | 1, mid + 1, r);
  update(node);
}
void modify(int node, int l, int r, int x, int w) {
  if (l > x || r < x) return;
  if (l == r) {
    seg[node] = w;
    return;
  }
  int mid = l + r >> 1;
  modify(node << 1, l, mid, x, w);
  modify(node << 1 | 1, mid + 1, r, x, w);
  update(node);
}
int query(int node, int l, int r, int fl, int fr) {
  if (fl <= l && r <= fr) return seg[node];
  int mid = l + r >> 1;
  if (mid >= fr)
    return query(node << 1, l, mid, fl, fr);
  else if (mid + 1 <= fl)
    return query(node << 1 | 1, mid + 1, r, fl, fr);
  else
    return min(query(node << 1, l, mid, fl, fr),
               query(node << 1 | 1, mid + 1, r, fl, fr));
}
int main() {
  int i, now, x, y;
  scanf("%d%d", &n, &K);
  for (i = 1; i <= n; i++) scanf("%d", &p[i]);
  for (i = 1; i <= n; i++) mp[p[i]] = i;
  build(1, 1, n);
  for (i = n; i; i--) {
    x = query(1, 1, n, max(1, mp[i] - K + 1), mp[i]);
    if (x != INF) {
      x = mp[x];
      vec[x].push_back(mp[i]);
      in[mp[i]]++;
    }
    x = query(1, 1, n, mp[i], min(n, mp[i] + K - 1));
    if (x != INF) {
      x = mp[x];
      vec[x].push_back(mp[i]);
      in[mp[i]]++;
    }
    modify(1, 1, n, mp[i], i);
  }
  for (i = 1; i <= n; i++)
    if (!in[i]) q.push(i);
  now = n;
  while (!q.empty()) {
    x = q.top();
    q.pop();
    p[now] = x;
    now--;
    for (i = 0; i <= (int)vec[x].size() - 1; i++) {
      y = vec[x][i];
      in[y]--;
      if (!in[y]) q.push(y);
    }
  }
  for (i = 1; i <= n; i++) printf("%d\n", p[i]);
}
