#include <bits/stdc++.h>
int a[110], rec[1010];
int main() {
  int n, m;
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 0; i < m; ++i) scanf("%d", &a[i]);
    int pre = -1;
    bool fail = 0;
    for (int i = 0; i < n; ++i) {
      int mv = 0, cur = -1;
      if (i && i != n - 1 && a[rec[0]] && rec[0] != pre)
        cur = rec[0];
      else {
        for (int j = 0; j < m; ++j)
          if (a[j] > mv && j != pre && (i != n - 1 || j != rec[0])) {
            cur = j;
            mv = a[j];
          }
      }
      if (cur == -1) {
        fail = 1;
        break;
      }
      --a[cur];
      rec[i] = cur;
      pre = cur;
    }
    if (fail)
      puts("-1");
    else {
      for (int i = 0; i < n - 1; ++i) printf("%d ", rec[i] + 1);
      printf("%d\n", rec[n - 1] + 1);
    }
  }
  return 0;
}
