#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[40];
pair<int, int> p[40];
int res[1010];
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  int cur = 0;
  for (int i = 0; i < n; i++) {
    cur = -1;
    for (int j = 0; j < m; j++) {
      if (a[j] && (i == 0 || j != res[i - 1]) && (i < n - 1 || j != res[0])) {
        if (i > 0) {
          if (j == res[0] || a[j] > a[cur]) cur = j;
        } else {
          if (cur == -1 || a[j] < a[cur]) cur = j;
        }
      }
    }
    if (cur == -1) break;
    a[cur]--;
    res[i] = cur;
  }
  if (cur == -1)
    cout << -1 << endl;
  else
    for (int i = 0; i < n; i++) cout << res[i] + 1 << " ";
  return 0;
}
