#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
template <class T>
T abs(T x) {
  return x > 0 ? x : -x;
}
int n;
int m;
int main() {
  cin >> m >> n;
  int a[40];
  for (int i = 0; i < (n); i++) cin >> a[i];
  int sa[40];
  memcpy(sa, a, sizeof(a));
  int ans[1000];
  for (int o = 0; o < (n); o++) {
    memcpy(a, sa, sizeof(a));
    ans[0] = o;
    a[o]--;
    int f = 1;
    for (int p = 1; p < m; p++) {
      int last = ans[p - 1];
      int col = 0, id = -1;
      if (p != m - 1 && a[o] > 0 && o != last) {
        col = a[o];
        id = o;
      }
      for (int i = 0; i < (n); i++)
        if (i != last && (p != m - 1 || i != o) && a[i] > col) {
          col = a[i];
          id = i;
        }
      if (id == -1) {
        f = 0;
        break;
      }
      ans[p] = id;
      a[id]--;
    }
    if (f) {
      for (int i = 0; i < (m); i++) cout << ans[i] + 1 << ' ';
      cout << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}
