#include <bits/stdc++.h>
using namespace std;
struct NN {
  int v, dex;
};
NN aa[50];
int L[50], R[50];
NN key[50];
int sta[1010], top;
int ans[1010];
bool cmp(const NN &cmp1, const NN &cmp2) { return cmp1.v < cmp2.v; }
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &aa[i].v);
    aa[i].dex = i;
  }
  sort(aa + 1, aa + m + 1, cmp);
  for (int i = 0; i <= m; i++) {
    L[i] = i - 1;
    R[i] = i + 1;
    key[i] = aa[i];
  }
  L[0] = m;
  R[m] = 0;
  if (m == 1) {
    printf("-1\n");
  } else {
    top = 0;
    while (true) {
      int a, b;
      if (L[0] == 0 || L[L[0]] == 0) {
        break;
      }
      a = L[L[0]];
      b = L[0];
      while (top + 1 < n && key[a].v > 0) {
        sta[top++] = key[b].dex;
        sta[top++] = key[a].dex;
        key[a].v--;
        key[b].v--;
      }
      if (top == n) {
        if (sta[top - 1] == sta[0]) {
          top--;
          key[a].v++;
        }
        break;
      }
      if (top + 1 == n) break;
      int c = L[L[L[0]]];
      R[c] = 0;
      L[0] = c;
      if (key[b].v != 0) {
        while (c != 0 && key[c].v > key[b].v) {
          c = L[c];
        }
        R[b] = R[c];
        L[b] = c;
        L[R[c]] = b;
        R[c] = b;
      }
    }
    if (top < n) {
      if (top + 1 == n) {
        int cc = -1;
        int id;
        for (int i = 0; i < top; i++) {
          bool ok = false;
          for (int j = R[0]; j != 0; j = R[j]) {
            if (key[j].v != 0 && key[j].dex != sta[(i - 1 + top) % top] &&
                key[j].dex != sta[i]) {
              ok = true;
              id = key[j].dex;
              break;
            }
          }
          if (ok) {
            cc = i;
            break;
          }
        }
        if (cc != -1) {
          for (int i = 0; i < cc; i++) ans[i] = sta[i];
          ans[cc] = id;
          for (int i = cc; i < top; i++) {
            ans[i + 1] = sta[i];
          }
          for (int i = 0; i < n; i++) {
            printf("%d", ans[i]);
            if (i != n - 1) printf(" ");
          }
          printf("\n");
        } else {
          printf("-1\n");
        }
      } else {
        if (L[0] == 0) {
          printf("-1\n");
        } else {
          int cc = 0;
          int a = L[0];
          int id = -1;
          for (int i = 0; i < top; i++) {
            if (key[a].v != 0 && key[a].dex != sta[(i - 1 + top) % 2] &&
                key[a].dex != sta[i]) {
              ans[cc++] = key[a].dex;
              ans[cc++] = sta[i];
              key[a].v--;
              if (cc + (top - i - 1) == n) {
                id = i + 1;
                break;
              }
            }
          }
          if (id != -1) {
            for (int i = id; i < top; i++) {
              ans[cc++] = sta[i];
            }
          }
          if (cc == n) {
            for (int i = 0; i < n; i++) {
              printf("%d", ans[i]);
              if (i != n - 1) printf(" ");
            }
            printf("\n");
          } else {
            printf("-1\n");
          }
        }
      }
    } else {
      for (int i = 0; i < n; i++) {
        printf("%d", sta[i]);
        if (i != n - 1) printf(" ");
      }
      printf("\n");
    }
  }
  return 0;
}
