#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <cstdio>

using namespace std;

vector<int> a;
int n, k;

int cnt_inverse(int index)
{
	int ans = 0;
	for (int i = 0; i < k; i++)
		for (int j = i + 1; j < k; j++)
			ans += a[index + i] > a[index + j];
	return ans;
}

int main()
{
	ifstream cin("scanner.in");
	ofstream cout("scanner.out");
	cin >> n >> k;
	vector<int> ans(n - k + 1);
	for (int i = 0;  i < n - k + 1; i++)
		cin >> ans[i];
	a.resize(n);
	for (int i = 0; i < n; i++)
		a[i] = i + 1;
	do
	{
		bool ok = true;
		for (int i = 0; i < n - k + 1; i++)
			if (cnt_inverse(i) != ans[i])
			{
				ok = false; 
				break;
			}
		if (ok) break;
		random_shuffle(a.begin(), a.end());
	} while (true);
	for (int i = 0; i < n; i++)
		cout << a[i] << " ";	
}