#include <bits/stdc++.h>
using namespace std;
int box[45];
int out[1005], len;
int main() {
  int n, m;
  while (scanf("%d %d", &n, &m) != EOF) {
    int i, j;
    for (i = 1; i <= m; ++i) {
      scanf("%d", &box[i]);
    }
    out[0] = -1;
    memset(out, 0, sizeof(out));
    int choice;
    for (i = 1; i <= n; ++i) {
      if (i == n) out[i + 1] = out[1];
      choice = 0;
      for (j = 1; j <= m; ++j) {
        if (j == out[i - 1] || j == out[i + 1]) continue;
        if (!choice || box[j] > box[choice] ||
            (box[choice] == box[j] && j == out[1]))
          choice = j;
      }
      if (box[choice] < 1) {
        printf("-1\n");
        break;
      }
      out[i] = choice;
      --box[choice];
    }
    if (i <= n) continue;
    for (i = 1; i <= n; ++i) {
      printf("%d", out[i]);
      if (i == n)
        printf("\n");
      else
        printf(" ");
    }
  }
  return 0;
}
