#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, k, num;
  pair<int, int> a[40 + 5];
  int b[1000 + 5];
  while (scanf("%d%d", &n, &m) != EOF) {
    for (i = 0; i < m; i++) {
      scanf("%d", &a[i].first);
      a[i].second = i + 1;
    }
    sort(a, a + m);
    num = 0;
    if (m != 1) {
      if (a[m - 1].first > n / 2) a[m - 1].first = n / 2;
      if (a[m - 2].first > n / 2) a[m - 2].first = n / 2;
      k = 0;
      for (i = m - 1; i >= 0; i--) {
        while (a[i].first) {
          b[k] = a[i].second;
          a[i].first--;
          num++;
          if (num == n) break;
          k += 2;
          if (k > n - 1) k = 1;
        }
        if (num == n) break;
      }
    }
    if (num == n) {
      for (i = 0; i < n - 1; i++) printf("%d ", b[i]);
      printf("%d\n", b[n - 1]);
    } else
      printf("-1\n");
  }
}
