#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > a;
vector<int> res;
int main() {
  int n, m, last = 0;
  cin >> n >> m;
  a.resize(m);
  for (int i = 0; i < (m); ++i) cin >> a[i].first, a[i].second = i + 1;
  sort((a).rbegin(), (a).rend());
  res.assign(n, -1);
  for (int i = 0; i < (m); ++i) {
    int tlast = -1;
    for (int j = 0; j < n && a[i].first > 0; j++) {
      int p = (j + last) % n, pp = (p + n - 1) % n, np = (p + 1) % n;
      if (res[p] < 0 && res[pp] != a[i].second && res[np] != a[i].second) {
        res[p] = a[i].second;
        tlast = p;
        a[i].first--;
      }
    }
    if (tlast != -1) last = tlast;
  }
  if (count((res).begin(), (res).end(), -1)) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 0; i < (n); ++i) cout << res[i] << (i + 1 == n ? '\n' : ' ');
  return 0;
}
