#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int a[40];
  for (int i = 0; i < (m); i++) scanf("%d", a + i);
  pair<int, int> ord[40];
  for (int i = 0; i < (m); i++) ord[i] = make_pair(-a[i], i);
  sort(ord, ord + m);
  int ans[1000], pos = 0;
  memset(ans, -1, sizeof ans);
  for (int k = 0; k < (2); k++) {
    for (int i = k; i < n; i += 2) {
      int now, j;
      for (j = 0; j < m; j++) {
        now = ord[pos].second;
        int prev = ans[(i - 1 + n) % n], next = ans[(i + 1) % n];
        if (a[now] > 0 && (prev != now && next != now)) break;
        pos = (pos + 1) % m;
      }
      if (j == m) {
        puts("-1");
        return 0;
      }
      ans[i] = now;
      a[now]--;
    }
  }
  for (int i = 0; i < (n); i++)
    printf("%d%c", ans[i] + 1, i < n - 1 ? ' ' : '\n');
  return 0;
}
