#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int a, b, c, d, i, j, n, m, k, T;
pair<int, int> mas[41], tmp[41];
vector<int> ans(0);
inline void die() {
  if ((int)((ans).size()) != n) {
    printf("-1\n");
    exit(0);
  }
  for (int _n((n)-1), i(0); i <= _n; i++) {
    if (i) printf(" ");
    printf("%d", ans[i] + 1);
  }
  printf("\n");
  exit(0);
}
inline bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
  if (a.first != b.first)
    return a.first > b.first;
  else
    return a.second < b.second;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int _n((m)-1), i(0); i <= _n; i++)
    scanf("%d", &mas[i].first), mas[i].second = i;
  memcpy(tmp, mas, sizeof(mas));
  if (m == 1) die();
  for (int _n((m)-1), h(0); h <= _n; h++) {
    ans.clear();
    memcpy(mas, tmp, sizeof(tmp));
    sort(mas, mas + m, cmp);
    ans.push_back(mas[0].second);
    --mas[0].first;
    sort(mas, mas + m, cmp);
    if (h == ans[0]) continue;
    a = 1;
    for (int _n((m)-1), j(0); j <= _n; j++) {
      if (mas[j].second == h) {
        if (mas[j].first == 0) {
          a = 0;
          break;
        }
        --mas[j].first;
        break;
      }
    }
    if (!a) continue;
    sort(mas, mas + m, cmp);
    while ((int)((ans).size()) < n - 1) {
      bool ok = 0;
      for (int _n((m)-1), j(0); j <= _n; j++) {
        if (mas[j].first <= 0) continue;
        for (int _n(((int)((ans).size())) - 1), i(0); i <= _n; i++) {
          if (ans[i] == mas[j].second) continue;
          if (i != (int)((ans).size()) - 1 && ans[i + 1] == mas[j].second)
            continue;
          --mas[j].first;
          --c;
          ans.insert(ans.begin() + i + 1, mas[j].second);
          sort(mas, mas + m, cmp);
          ok = 1;
          break;
        }
        if (ok) break;
      }
      if (!ok) break;
    }
    if ((int)((ans).size()) != n - 1 || ans.back() == h) continue;
    ans.push_back(h);
    die();
  }
  ans.clear();
  die();
}
