#include <bits/stdc++.h>
using namespace std;
int a[55], b[55];
int ret[1005], ans[1005];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &a[i]), b[i] = a[i];
  a[m] = 0;
  for (int i = 0; i < n - 1; i++) {
    int mj = m;
    for (int j = 0; j < m; j++)
      if (a[j] >= a[mj] && (i == 0 || j != ret[i - 1])) mj = j;
    ret[i] = mj;
    if (a[mj] == 0) {
      printf("-1\n");
      return 0;
    }
    a[mj]--;
  }
  ret[n - 1] = -1;
  for (int i = 0; i < m; i++)
    if (i != ret[0] && i != ret[n - 2] && a[i] > 0) {
      ret[n - 1] = i;
      break;
    }
  if (ret[n - 1] == -1) {
    for (int i = 0; i < m; i++)
      if (a[i] > 0)
        for (int j = 0; j < n - 2; j++)
          if (ret[j] != i && ret[j + 1] != i) {
            for (int k = n - 2; k >= j + 1; k--) ret[k + 1] = ret[k];
            ret[j + 1] = i;
            goto here;
          }
    printf("-1\n");
  } else {
  here:;
    for (int i = 0; i < n - 1; i++) printf("%d ", ret[i] + 1);
    printf("%d\n", ret[n - 1] + 1);
  }
}
