#include <bits/stdc++.h>
using namespace std;
vector<pair<int, pair<int, int> > > a;
int n, m, res[1001];
int main() {
  scanf("%d %d", &n, &m);
  a.resize(m);
  for (int i = 0, _n = m; i < _n; i++) {
    scanf("%d", &a[i].first);
    a[i].second.first = 0;
    a[i].second.second = i + 1;
  }
  sort(a.rbegin(), a.rend());
  for (int i = 0, _n = m; i < _n; i++) {
    a[i].second.first = m - i;
  }
  int prev = -1;
  for (int i = 0, _n = n - 1; i < _n; i++) {
    sort(a.begin(), a.end());
    if (a[m - 1].first > 0 && a[m - 1].second.second != prev) {
      prev = res[i] = a[m - 1].second.second;
      a[m - 1].first--;
    } else if (m > 1 && a[m - 2].first > 0 && a[m - 2].second.second != prev) {
      prev = res[i] = a[m - 2].second.second;
      a[m - 2].first--;
    } else {
      prev = -1;
      break;
    }
  }
  if (prev != -1) {
    sort(a.begin(), a.end());
    if (a[m - 1].first > 0 && a[m - 1].second.second != prev &&
        a[m - 1].second.second != res[0]) {
      prev = res[n - 1] = a[m - 1].second.second;
      a[m - 1].first--;
    } else if (m > 1 && a[m - 2].first > 0 && a[m - 2].second.second != prev &&
               a[m - 2].second.second != res[0]) {
      prev = res[n - 1] = a[m - 2].second.second;
      a[m - 2].first--;
    } else if (m > 2 && a[m - 3].first > 0 && a[m - 3].second.second != prev &&
               a[m - 3].second.second != res[0]) {
      prev = res[n - 1] = a[m - 3].second.second;
      a[m - 3].first--;
    } else {
      prev = -1;
    }
  }
  if (prev == -1)
    puts("-1");
  else {
    for (int i = 0, _n = n; i < _n; i++) {
      if (i > 0) printf(" ");
      printf("%d", res[i]);
    }
    puts("");
  }
}
