import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;

public class Validate {
	final int MAXN = 100000;
	final int MAXK = 5;
        public void run() {
		StrictScanner inf = new StrictScanner(System.in);
		int n = inf.nextInt();
		int k = inf.nextInt();
		ensureLimits(n, 2, MAXN, "incorrect n");
		ensureLimits(k, 2, MAXK, "incorrect k");
		inf.nextLine();
		int[] a = new int[n - k + 1];
		for (int i = 0; i < n - k + 1; i++) {
			a[i] = inf.nextInt();               
			ensure(a[i] >= 0, "");
		}
		inf.nextLine();
		ensure(Solution(a, n, k), "Bad test or jury's solution (solution didn't find the permutation");
		inf.close();
	}



        	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;

	boolean Solution(int[] a, int n, int k) {

                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++;
					}
					return true;
				}
			}
		} while (nextPermutation(pk));
		return false;
	}

		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;
	}


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

	public class StrictScanner {
		private final BufferedReader in;
		private String line = "";
		private int pos;
		private int lineNo;

		public StrictScanner(InputStream source) {
			in = new BufferedReader(new InputStreamReader(source));
			nextLine();
		}

		public void close() {
			ensure(line == null, "Extra data at the end of file");
			try {
				in.close();
			} catch (IOException e) {
				throw new AssertionError("Failed to close with " + e);
			}
		}

		public void nextLine() {
			ensure(line != null, "EOF");
			ensure(pos == line.length(), "Extra characters on line " + lineNo);
			try {
				line = in.readLine();
			} catch (IOException e) {
				throw new AssertionError("Failed to read line with " + e);
			}
			pos = 0;
			lineNo++;
		}

        	public String getNextLine() {
        	       String st = "";
			while (!isEoln()) {
				st = st + next();
			}
			return st;
		}


		public boolean isEoln() {
			return (pos == line.length());
		}

		public String next() {
			ensure(line != null, "EOF");
			ensure(line.length() > 0, "Empty line " + lineNo);
			if (pos == 0)
				ensure(line.charAt(0) > ' ', "Line " + lineNo
						+ " starts with whitespace");
			else {
				ensure(pos < line.length(), "Line " + lineNo + " is over");
				ensure(line.charAt(pos) == ' ', "Wrong whitespace on line "
						+ lineNo);
				pos++;
				ensure(pos < line.length(), "Line " + lineNo + " is over");
				ensure(line.charAt(0) > ' ', "Line " + lineNo
						+ " has double whitespace");
			}
			StringBuilder sb = new StringBuilder();
			while (pos < line.length() && line.charAt(pos) > ' ')
				sb.append(line.charAt(pos++));
			return sb.toString();
		}

		public int nextInt() {
			String s = next();
			ensure(s.length() == 1 || s.charAt(0) != '0',
					"Extra leading zero in number " + s + " on line " + lineNo);
			ensure(s.charAt(0) != '+', "Extra leading '+' in number " + s
					+ " on line " + lineNo);
			try {
				return Integer.parseInt(s);
			} catch (NumberFormatException e) {
				throw new AssertionError("Malformed number " + s + " on line "
						+ lineNo);
			}
		}

		public long nextLong() {
			String s = next();
			ensure(s.length() == 1 || s.charAt(0) != '0',
					"Extra leading zero in number " + s + " on line " + lineNo);
			ensure(s.charAt(0) != '+', "Extra leading '+' in number " + s
					+ " on line " + lineNo);
			try {
				return Long.parseLong(s);
			} catch (NumberFormatException e) {
				throw new AssertionError("Malformed number " + s + " on line "
						+ lineNo);
			}
		}

		public double nextDouble() {
			String s = next();
			ensure(s.length() == 1 || s.startsWith("0.") || s.charAt(0) != '0',
					"Extra leading zero in number " + s + " on line " + lineNo);
			ensure(s.charAt(0) != '+', "Extra leading '+' in number " + s
					+ " on line " + lineNo);
			try {
				return Double.parseDouble(s);
			} catch (NumberFormatException e) {
				throw new AssertionError("Malformed number " + s + " on line "
						+ lineNo);
			}
		}
	}

	public static class Geometry {
		/**
		 * Distance between two points (x1; y1) and (x2; y2)
		 * @param x1
		 * @param y1
		 * @param x2
		 * @param y2
		 * @return
		 */
		public static double dist(int x1, int y1, int x2, int y2) {
			long x3 = x1;
			long y3 = y1;
			long x4 = x2;
			long y4 = y2;
		       return Math.sqrt((x3 - x4) * (x3 - x4) + (y3 - y4) * (y3 - y4));
		}
	}
	
	public static class Graph {
		/**
		 * Adjacency matrix
		 * 0 or -1 if edge is empty
		 * other positive int if not
		 * @param e
		 * @return
		 */
		private static boolean dfsCheckForTree(int k, int p, boolean[] f, int[][] e) {
			f[k] = true;
			for (int i = 0; i < f.length; i++) {
				if (e[k][i] > 0 && !f[i]) {
					dfsCheckForTree(i, k, f, e);
				} else {
					if (e[k][i] > 0 && f[i] && i != p) {
						return false;
					}
				}
			}
			return true;
		}
		
		public static boolean isTree(int[][] e) {
			for (int i = 0; i < e.length; i++) {
				ensure(e[i].length == e.length, "Bad adjacency matrix given to class Graph");
			}
			ensure(e.length != 0, "Empty adjacency matrix given to class Graph");
			boolean[] visited = new boolean[e.length];
			if (!dfsCheckForTree(0, -1, visited, e)) ;
			boolean ans = true;
			for (int i = 0; i < e.length; i++) {
				ans &= visited[i]; 
			}
			return ans;
		}
	}

	static void ensure(boolean b, String message) {
		if (!b) {
			throw new AssertionError(message);
		}
	}

	void ensureString(String s, String alph, String text) {
		for (int i = 0; i < s.length(); i++) {
			ensure(alph.indexOf(s.charAt(i)) != -1, text);
		}
	}

	void ensureLimits(long n, long from, long to, String name) {
		ensure(from <= n && n <= to, name + " must be from " + from + " to "
				+ to);
	}

	void ensureLimits(int n, int from, int to, String name) {
		ensure(from <= n && n <= to, name + " must be from " + from + " to "
				+ to);
	}

	String line(int x) {
		return "Problem in line #" + Integer.toString(x);
	}

}

