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

public class scanner_dk {
	BufferedReader br;
	PrintWriter out;
	StringTokenizer stok;

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

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

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

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

	char nextChar() throws IOException {
		return (char) (br.read());
	}

	String nextLine() throws IOException {
		return br.readLine();
	}

	class Pair implements Comparable<Pair> {
		public Pair(double x, int id) {
			super();
			this.x = x;
			this.id = id;
		}

		double x;
		int id;

		@Override
		public int compareTo(Pair arg0) {
			// TODO Auto-generated method stub
			if (x > arg0.x)
				return 1;

			if (x < arg0.x)
				return -1;
			return 0;
		}

	}

	public boolean nextPermutation(int[] p) {
		for (int a = p.length - 2; a >= 0; --a)
			if (p[a] < p[a + 1])
				for (int b = p.length - 1;; --b)
					if (p[b] > p[a]) {
						int t = p[a];
						p[a] = p[b];
						p[b] = t;
						for (++a, b = p.length - 1; a < b; ++a, --b) {
							t = p[a];
							p[a] = p[b];
							p[b] = t;
						}
						return true;
					}
		return false;
	}

	static void dfs(List<Integer>[] graph, boolean[] used, List<Integer> res, int u) {
	    used[u] = true;
	    for (int v : graph[u])
	      if (!used[v])
	        dfs(graph, used, res, v);
	    res.add(u);
	  }

	  public static List<Integer> topologicalSort(List<Integer>[] graph) {
	    int n = graph.length;
	    boolean[] used = new boolean[n];
	    List<Integer> res = new ArrayList<Integer>();
	    for (int i = 0; i < n; i++)
	      if (!used[i])
	        dfs(graph, used, res, i);
	    Collections.reverse(res);
	    return res;
	  }
	
	ArrayList<Integer>[] e;
	List<Integer> ans;
	void solve() throws IOException {
		int n = nextInt();
		int k = nextInt();
		int m = n - k + 1;
		int[] a = new int[m];
		for (int i = 0; i < m; i++) {
			a[i] = nextInt();
		}
		int[] pk = new int[k];
		for (int i = 0; i < k; i++) {
			pk[i] = i;
		}
		do {
			if (countOfInversions(pk) == a[0]) {
				boolean f = true;
				e = new ArrayList[n];
				for (int i = 0; i < n; i++) {
					e[i] = new ArrayList<Integer>();
				}
				Pair[] cur = new Pair[n];
				for (int i = 0; i < k; i++) {
					cur[i] = new Pair(pk[i], i);
				}
				for (int i = 0; i < k; i++) {
					for (int j = i + 1; j < k; j++) {
						if (pk[i] < pk[j]) {
							e[i].add(j);
						} else {
							e[j].add(i);
						}
					}
				}
				for (int i = k; i < n; i++) {
					int needInversions = a[i - k + 1]
							- countOfInv(cur, i - k + 1, i - 1);
					double[] tmp = new double[k - 1];
					for (int j = i - k + 1; j <= i - 1; j++) {
						tmp[j - (i - k + 1)] = cur[j].x;
					}
					Arrays.sort(tmp);
					double value;
					if (needInversions < 0 || needInversions > k - 1) {
						f = false;
						break;
					} else 
					if (needInversions == 0) {
						value = tmp[k - 2] + 1;
					} else if (needInversions == k - 1) {
						value = tmp[0] - 1;
					} else {
						value = (tmp[k - 2 - needInversions] + tmp[k - 1
								- needInversions]) / 2;
					}
					for (int j = i - k + 1; j <= i - 1; j++) {
						if (cur[j].x < value) {
							e[j].add(i);
						} else {
							e[i].add(j);
						}
					}
					cur[i] = new Pair(value, i);
				}
				if (f) {
					//topsort
					ans = topologicalSort(e);
					int[] p = new int[n];
					int kk = 1;
					for (Integer i : ans) {
						p[i] = kk++;
					}
					for (int i = 0; i < n; i++) {
						out.print(p[i] + (i == n - 1 ? "\n" : " "));
					}
					return;
				}
			}
		} while (nextPermutation(pk));
	}

	private int countOfInv(Pair[] cur, int i1, int j1) {
		// TODO Auto-generated method stub
		int ans = 0;
		for (int i = i1; i <= j1; i++) {
			for (int j = i + 1; j <= j1; j++) {
				if (cur[i].x > cur[j].x) {
					ans++;
				}
			}
		}
		return ans;
	}

	private int countOfInversions(int[] pk) {
		// TODO Auto-generated method stub
		int ans = 0;
		for (int i = 0; i < pk.length; i++) {
			for (int j = i + 1; j < pk.length; j++) {
				if (pk[i] > pk[j]) {
					ans++;
				}
			}
		}
		return ans;
	}

	void run() throws IOException {
		br = new BufferedReader(new FileReader("scanner.in"));
		out = new PrintWriter("scanner.out");
		// br = new BufferedReader(new InputStreamReader(System.in));
		// out = new PrintWriter(System.out);
		solve();
		br.close();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		// Locale.setDefault(Locale.US);
		new scanner_dk().run();
	}
}