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;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &t) {
  os << "[";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "]";
  return os;
}
template <class T>
ostream &operator<<(ostream &os, const set<T> &t) {
  os << "{";
  for (__typeof((t).begin()) it = (t).begin(); it != (t).end(); it++) {
    if (it != t.begin()) os << ",";
    os << *it;
  }
  os << "}";
  return os;
}
template <class S, class T>
ostream &operator<<(ostream &os, const pair<S, T> &t) {
  return os << "(" << t.first << "," << t.second << ")";
}
template <class S, class T>
pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first + t.first, s.second + t.second);
}
template <class S, class T>
pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) {
  return pair<S, T>(s.first - t.first, s.second - t.second);
}
const int INF = 1 << 28;
const double EPS = 1e-8;
const int MOD = 1000000007;
struct handler {
  handler() {}
  pair<int, int> def_val() { return pair<int, int>(-1, -1); }
  static pair<int, int> update(const pair<int, int> &l,
                               const pair<int, int> &r) {
    return r;
  }
  static pair<int, int> merge(const pair<int, int> &l,
                              const pair<int, int> &r) {
    return max(l, r);
  }
};
template <typename Handler>
struct SegTree {
  vector<typename Handler::val_t> val;
  Handler hdl;
  int n;
  SegTree(int size) : hdl() {
    n = 1;
    while (n < size) n <<= 1;
    val = vector<typename Handler::val_t>(2 * n, hdl.def_val());
  }
  SegTree(const vector<typename Handler::val_t> &in) : hdl() {
    n = 1;
    while (n < in.size()) n <<= 1;
    val = vector<typename Handler::val_t>(2 * n, hdl.def_val());
    for (int i = n - 1 + in.size() - 1; i >= 0; i--) {
      if (n - 1 <= i)
        val[i] = in[i - (n - 1)];
      else
        val[i] = hdl.merge(val[i * 2 + 1], val[i * 2 + 2]);
    }
  }
  void update(int i, const typename Handler::opr_t &a) {
    i += n - 1;
    val[i] = hdl.update(val[i], a);
    while (i > 0) {
      i = (i - 1) / 2;
      val[i] = hdl.merge(val[i * 2 + 1], val[i * 2 + 2]);
    }
  }
  typename Handler::val_t query(int a, int b, int k, int l, int r) {
    if (r <= a || b <= l) return hdl.def_val();
    if (a <= l && r <= b) return val[k];
    return hdl.merge(query(a, b, k * 2 + 1, l, (l + r) / 2),
                     query(a, b, k * 2 + 2, (l + r) / 2, r));
  }
  typename Handler::val_t query(int a, int b) { return query(a, b, 0, 0, n); }
  typename Handler::val_t operator[](size_t i) { return query(i, i + 1); }
  friend ostream &operator<<(ostream &os, SegTree<Handler> &t) {
    for (int i = 0; i < (int)(t.n); i++)
      os << (i ? ", " : "[") << t.query(i, i + 1);
    return os << "]";
  }
};
int T, n, m;
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin >> n >> m;
  vector<int> p(n);
  for (int i = 0; i < (int)(n); i++) {
    int x;
    cin >> x;
    x--;
    p[x] = i;
  }
  SegTree<handler> seg(n);
  vector<vector<int> > g(n);
  vector<int> deg(n);
  for (int i = 0; i < (int)(n); i++) {
    for (auto ret : {seg.query(max(0, p[i] - m + 1), p[i]),
                     seg.query(p[i] + 1, min(n, p[i] + m))}) {
      if (ret.first != -1) {
        g[p[i]].emplace_back(ret.second);
        deg[ret.second]++;
      }
    }
    seg.update(p[i], pair<int, int>(i, p[i]));
  }
  priority_queue<int> pq;
  for (int i = 0; i < (int)(n); i++)
    if (deg[i] == 0) pq.push(i);
  vector<int> ans;
  while (!pq.empty()) {
    int u = pq.top();
    pq.pop();
    ans.push_back(u);
    for (int v : g[u])
      if (--deg[v] == 0) {
        pq.push(v);
      }
  }
  assert(ans.size() == n);
  reverse((ans).begin(), (ans).end());
  for (int x : ans) cout << x + 1 << endl;
  return 0;
}
