#include <bits/stdc++.h>
using namespace std;
template <class TT>
TT abs(TT a) {
  if (a < 0) return -a;
  return a;
}
typedef struct {
  int c, p, l;
} P;
bool com(P a, P b) {
  if (a.c != b.c) return a.c > b.c;
  return a.l < b.l;
}
P p[44];
int f[1022];
int main() {
  int i, j, k, l, n, m, cnt;
  while (cin >> n >> m) {
    for (i = 0; i < m; i++) {
      cin >> k;
      p[i] = (P){k, i + 1, 20000};
    }
    memset(f, -1, sizeof(f));
    sort(p, p + m, com);
    f[0] = f[n] = p[0].p;
    p[0].c--;
    p[0].l = 0;
    for (i = 1; i < n; i++) {
      sort(p, p + m, com);
      l = -1;
      j = 0;
      while (j < m) {
        if (f[i - 1] == p[j].p || f[i + 1] == p[j].p) {
          j++;
          continue;
        }
        if (p[j].c) {
          l = j;
          break;
        }
        break;
      }
      if (l == -1) break;
      f[i] = p[l].p;
      p[l].c--;
      p[l].l = i;
    }
    if (f[n - 1] == -1) {
      printf("-1\n");
      continue;
    }
    for (i = 0; i < n; i++) {
      if (i) printf(" ");
      printf("%d", f[i]);
    }
    cout << endl;
  }
  return 0;
}
