#include <bits/stdc++.h>
using namespace std;
int n, m, a[50];
int boo[1005];
int main() {
  cin >> n >> m;
  for (int i = 0, _e(m); i < _e; i++) cin >> a[i];
  vector<pair<int, int> > v;
  for (int i = 0, _e(m); i < _e; i++) v.push_back(pair<int, int>(a[i], i));
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  memset((boo), (-1), sizeof(boo));
  bool done = 0;
  for (int i = 0, _e(m); i < _e; i++) {
    for (int j = 0; j < n; j += 2)
      if (boo[j] == -1 && v[i].first) {
        if (boo[(j - 1 + n) % n] != v[i].second &&
            boo[(j + 1) % n] != v[i].second)
          boo[j] = v[i].second, v[i].first--;
      }
  }
  for (int i = 0, _e(m); i < _e; i++) {
    for (int j = 0, _e(n); j < _e; j++)
      if (boo[j] == -1 && v[i].first) {
        if (boo[(j - 1 + n) % n] != v[i].second &&
            boo[(j + 1) % n] != v[i].second)
          boo[j] = v[i].second, v[i].first--;
      }
  }
  bool ok = 1;
  for (int i = 0, _e(n); i < _e; i++)
    if (boo[i] == -1) ok = 0;
  if (!ok)
    cout << -1 << endl;
  else {
    for (int i = 0, _e(n); i < _e; i++) {
      if (i) cout << " ";
      cout << boo[i] + 1;
    }
    cout << endl;
  }
  return 0;
}
