#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:264777216")
const int size = 100001;
pair<int, int> a[100];
int res[size];
int insert(int *r, int &n, int index, int val) {
  for (int i = n; i > index; --i) {
    r[i] = r[i - 1];
  }
  r[index] = val;
  ++n;
  int old = index;
  index -= 1;
  index += n + 1;
  index %= n + 1;
  index += n + 1;
  index %= n + 1;
  if (index == n && old == 0) index = n - 1;
  return index;
}
void Solve() {
  int n;
  int m;
  cin >> n >> m;
  int sum = 0;
  for (int i = 0; i < m; ++i) {
    cin >> a[i].first;
    a[i].second = i;
  }
  sort(a, a + m);
  int nres = 0;
  int index = 0;
  for (int i = m - 1; i >= 0; --i) {
    for (int j = 0; j < a[i].first; ++j) {
      index = insert(res, nres, index, a[i].second);
    }
    if (i == m - 1) index = nres;
    if (nres >= 2300) break;
  }
  for (int j = 0; j + n <= nres; ++j) {
    bool isOk = true;
    for (int i = j; i < n + j && isOk; ++i) {
      int j1 = (i + 1 - j) % n + j;
      int j2 = (i - 1 + n - j) % n + j;
      if (res[j1] == res[i] || res[j2] == res[i]) isOk = false;
    }
    if (isOk) {
      for (int i = j; i < n + j; ++i) {
        printf("%d ", res[i] + 1);
      }
      return;
    }
  }
  cout << -1;
}
int main() {
  Solve();
  return 0;
}
