#include <bits/stdc++.h>
using namespace std;
const int MAX = 1020;
struct List1 {
  struct node {
    int key, prev, nxt;
    node() {}
    node(int a, int b, int c) : key(a), prev(b), nxt(c) {}
  };
  node an[MAX];
  int front, tail, cnt;
  List1() { front = tail = -1, cnt = 0; }
  bool isEmpty() { return front == -1; }
  void insert_b(int pos, int key) {
    int idx = cnt;
    ++cnt, an[idx].key = key;
    an[idx].nxt = an[pos].nxt, an[idx].prev = pos;
    if (an[pos].nxt != -1) an[an[pos].nxt].prev = idx;
    an[pos].nxt = idx;
    if (an[idx].nxt == -1) tail = idx;
  }
  void push_front(int key) {
    int idx = cnt;
    ++cnt, an[idx].key = key;
    if (front == -1) {
      an[idx].nxt = an[idx].prev = -1, front = tail = idx;
    } else {
      an[idx].prev = -1, an[idx].nxt = front, an[front].prev = idx;
      front = idx;
    }
  }
  int getK(int idx) { return an[idx].key; }
};
List1 ans;
int bn[MAX];
int n, k;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (1); i <= (n); ++i) scanf("%d", &bn[i]);
  ans.push_front(n);
  for (int i = (n - 1); i >= (1); --i) {
    int t1 = i + k, t2 = n - t1 + 1;
    if (t2 <= 0)
      ans.push_front(i);
    else {
      int bound = t2 - bn[i];
      int idx = ans.tail;
      while (!(bound == 0 && (idx == -1 || ans.getK(idx) >= t1))) {
        if (ans.getK(idx) >= t1)
          bound--, idx = ans.an[idx].prev;
        else
          idx = ans.an[idx].prev;
      }
      if (idx == -1)
        ans.push_front(i);
      else
        ans.insert_b(idx, i);
    }
  }
  for (int idx = ans.front; idx != -1; idx = ans.an[idx].nxt)
    printf("%d ", ans.getK(idx));
  printf("\n");
  return 0;
}
