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 <typename T>
inline bool chkmax(T &x, const T &y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T &x, const T &y) {
  return x > y ? x = y, 1 : 0;
}
struct IO {
  static const int maxn = (1 << 25) + 10;
  char a[maxn], *s, b[maxn], *t;
  void INPUT() {
    s = a;
    t = b;
    a[fread(a, 1, sizeof a, stdin)] = 0;
  }
  void OUTPUT() { fwrite(b, 1, t - b, stdout); }
  operator int() {
    int x = 0;
    while (*s != '-' && (*s < '0' || *s > '9')) {
      ++s;
    }
    bool f = 0;
    if (*s == '-') {
      f = 1;
      ++s;
    }
    while (*s >= '0' && *s <= '9') {
      (x *= 10) += *s - '0';
      ++s;
    }
    if (f) {
      x = -x;
    }
    return x;
  }
  operator long long() {
    long long x = 0;
    while (*s != '-' && (*s < '0' || *s > '9')) {
      ++s;
    }
    bool f = 0;
    if (*s == '-') {
      f = 1;
      ++s;
    }
    while (*s >= '0' && *s <= '9') {
      (x *= 10) += *s - '0';
      ++s;
    }
    if (f) {
      x = -x;
    }
    return x;
  }
  operator char() {
    while (*s <= 32) {
      ++s;
    }
    char ret = *s;
    ++s;
    return ret;
  }
  inline void out(int x) {
    if (!x) {
      *t++ = '0';
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      int y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    return;
  }
  inline void out(int x, char C) {
    if (!x) {
      *t++ = '0';
      *t++ = C;
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      int y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    *t++ = C;
    return;
  }
  inline void out(long long x) {
    if (!x) {
      *t++ = '0';
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      long long y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    return;
  }
  inline void out(long long x, char C) {
    if (!x) {
      *t++ = '0';
      *t++ = C;
      return;
    }
    if (x < 0) {
      *t++ = '-';
      x = -x;
    }
    static char c[20], *i;
    i = c;
    while (x) {
      long long y = x / 10;
      *i++ = x - y * 10 + '0';
      x = y;
    }
    while (i != c) {
      *t++ = *--i;
    }
    *t++ = C;
    return;
  }
  inline void out(char c) {
    *t++ = c;
    return;
  }
  inline void out(char *s) {
    while (*s >= ' ') {
      *t++ = *s++;
    }
    return;
  }
} io;
void Main();
int main(int argc, char *argv[]) {
  io.INPUT();
  Main();
  io.OUTPUT();
  return 0;
}
int n, k, *p, *ans;
void update(int &x, int y) {
  x = (x == n || y < n && p[y] < p[x]) ? y : x;
  return;
}
struct node {
  node *ch[2];
  int num;
  node() { memset(ch, 0, sizeof num); }
  void pull() {
    num = n;
    for (int i = 0, i_end_ = (2); i < i_end_; ++i) {
      update(num, ch[i]->num);
    }
    return;
  }
} * root;
int seg_a, seg_b, seg_q;
set<int> heap;
void B(node *&u = root, int l = 0, int r = n - 1) {
  u = new node;
  if (l == r) {
    u->num = l;
    return;
  }
  int mid = l + r >> 1;
  B(u->ch[0], l, mid);
  B(u->ch[1], mid + 1, r);
  return u->pull();
}
void M(node *&u = root, int l = 0, int r = n - 1) {
  if (l == r) {
    u->num = seg_q;
    return;
  }
  int mid = l + r >> 1;
  if (seg_a <= mid) {
    M(u->ch[0], l, mid);
  } else {
    M(u->ch[1], mid + 1, r);
  }
  return u->pull();
}
void Q(node *&u = root, int l = 0, int r = n - 1) {
  if (seg_a <= l && r <= seg_b) {
    update(seg_q, u->num);
    return;
  }
  int mid = l + r >> 1;
  if (seg_a <= mid) {
    Q(u->ch[0], l, mid);
  }
  if (mid < seg_b) {
    Q(u->ch[1], mid + 1, r);
  }
  return;
}
void Main() {
  n = io;
  k = io;
  p = new int[n];
  ans = new int[n];
  for (int i = 0, i_end_ = (n); i < i_end_; ++i) {
    p[i] = io;
  }
  B();
  for (int i = 0; i < n; i += k) {
    seg_a = i, seg_b = min(i + k, n) - 1;
    seg_q = n;
    Q();
    if (seg_q < n) {
      int i = seg_q;
      seg_a = max(0, i - k + 1), seg_b = min(n - 1, i + k - 1);
      seg_q = n;
      Q();
      if (i == seg_q) {
        heap.insert(i);
      }
    }
  }
  int cnt = 0;
  while ((int)((heap).size())) {
    int i = *heap.begin();
    ans[i] = ++cnt;
    heap.erase(heap.begin());
    seg_a = i;
    seg_q = n;
    M();
    i = i / k * k;
    seg_a = i, seg_b = min(i + k, n);
    seg_q = n;
    Q();
    if (seg_q < n) {
      int i = seg_q;
      seg_a = max(0, i - k + 1), seg_b = min(n - 1, i + k - 1);
      seg_q = n;
      Q();
      if (i == seg_q) {
        heap.insert(i);
      }
    }
    i -= k;
    if (i >= 0) {
      seg_a = i, seg_b = min(i + k, n);
      seg_q = n;
      Q();
      if (seg_q < n) {
        int i = seg_q;
        seg_a = max(0, i - k + 1), seg_b = min(n - 1, i + k - 1);
        seg_q = n;
        Q();
        if (i == seg_q) {
          heap.insert(i);
        }
      }
    }
  }
  for (int i = 0, i_end_ = (n); i < i_end_; ++i) {
    io.out(ans[i], '\n');
  }
  return;
}
