#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[1000 + 10];
int a1[1000 + 10];
int ans[1000 + 10];
int main() {
  int i, j, ok;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= m; i++) scanf("%d", &a1[i]);
  for (int i1 = m; i1 >= 1; i1--) {
    memset(ans, 0, sizeof(ans));
    memcpy(a, a1, sizeof(a1));
    ok = 1;
    ans[1] = i1;
    a[i1]--;
    for (i = 2; i <= n; i++) {
      int pos = 0;
      for (j = 1; j <= m; j++)
        if (a[pos] < a[j] && j != ans[i - 1] && j != ans[(i + 1) % n]) pos = j;
      if (pos == 0) {
        ok = 0;
        break;
      }
      ans[i] = pos;
      a[pos]--;
    }
    if (ok) break;
  }
  if (!ok) {
    printf("-1");
    return 0;
  }
  printf("%d", ans[1]);
  for (i = 2; i <= n; i++) printf(" %d", ans[i]);
}
