#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[55];
int ans[1005];
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    memset(a, 0, sizeof(a));
    memset(ans, 0, sizeof(ans));
    for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
    ans[1] = 1;
    a[1]--;
    for (int i = 2; i <= n; i++) {
      int cho = 0;
      for (int j = 1; j <= m; j++)
        if (a[cho] < a[j] && j != ans[i - 1] && j != ans[(i + 1) % n]) cho = j;
      if (cho == 0) {
        printf("-1\n");
        return 0;
      }
      ans[i] = cho;
      a[cho]--;
    }
    for (int i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
  }
  return 0;
}
