import java.io.*;
import java.util.*;

public class battle_vd {

	int[] fenv;

	int get(int x) {
		int res = 0;
		while (x > 0) {
			res += fenv[x];
			x = x & (x - 1);
		}
		return res;
	}

	void update(int x) {
		while (x <= n) {
			fenv[x]++;
			x = 2 * x - (x & (x - 1));
		}
	}

	int n;

	int[] res;

	int getPos(int free) {
		int l = 1;
		int r = n + 1;
		while (l < r - 1) {
			int x = (l + r) / 2;
			int sum = (x - 1) - get(x - 1);
			if (sum > free) {
				r = x;
			} else {
				l = x;
			}
		}
		return l;
	}

	void solve() throws IOException {
		n = nextInt();
		int k = nextInt();
		fenv = new int[n + 1];
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = nextInt();
		}
		int[] cinv = new int[n + 1];
		for (int i = 0; i < n; i++) {
			cinv[a[i]] = i - get(a[i]);
			update(a[i]);
		}
		for (int i = 0; i < n; i++) {
			cinv[i] = Math.max(0, cinv[i] - k);
		}
		res = new int[n + 1];
		Arrays.fill(fenv, 0);
		for (int i = 1; i <= n; i++) {
			int pos = getPos(cinv[i]);
			res[pos] = i;
			update(pos);
		}
		for (int i = 1; i <= n - 1; i++) {
			out.print(res[i] + " ");
		}
		out.println(res[n]);
	}

	public void run() throws IOException {
		br = new BufferedReader(new FileReader("battle.in"));
		out = new PrintWriter("battle.out");
		solve();
		br.close();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new battle_vd().run();
	}

	BufferedReader br;
	StringTokenizer str;
	PrintWriter out;

	String next() throws IOException {
		while (str == null || !str.hasMoreTokens()) {
			String s = br.readLine();
			if (s != null) {
				str = new StringTokenizer(s);
			} else {
				return null;
			}
		}
		return str.nextToken();
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

}
