#include <bits/stdc++.h>
using namespace std;
int n, target;
int ar[40];
int sol[1001];
int main() {
  scanf("%d %d", &target, &n);
  int i;
  for (i = 0; i < n; i++) scanf("%d", &ar[i]);
  int it;
  for (it = 0; it < target; it++) {
    int maxv = 0;
    int tmax = -1;
    for (i = 0; i < n; i++)
      if (ar[i]) {
        if (it > 0 && i == sol[it - 1]) continue;
        if (it == target - 1 && i == sol[0]) continue;
        if (ar[i] > maxv || (it > 0 && ar[i] == maxv && i == sol[0])) {
          maxv = ar[i];
          tmax = i;
        }
      }
    if (tmax == -1) break;
    ar[tmax]--;
    sol[it] = tmax;
  }
  if (it < target)
    printf("-1\n");
  else {
    for (i = 0; i < target; i++) {
      if (i) printf(" ");
      printf("%d", sol[i] + 1);
    }
    printf("\n");
  }
}
