#include <bits/stdc++.h>
using namespace std;
int a[10000], m, n;
pair<int, int> b[50];
void gao(int s) {
  int i, j;
  for (i = s; i < n; i += 2) {
    for (j = m - 1; j >= 0; j--)
      if (b[j].first > 0 && b[j].second != a[(i - 1 + n) % n] &&
          b[j].second != a[(i + 1) % n]) {
        b[j].first--;
        a[i] = b[j].second;
        break;
      }
  }
}
int main() {
  int i, j, k;
  scanf("%d%d", &n, &m);
  for (i = 0; i < m; i++) {
    scanf("%d", &b[i].first);
    b[i].second = i;
  }
  memset(a, -1, sizeof(a));
  sort(b, b + m);
  gao(0);
  gao(1);
  if (count(a, a + n, -1) > 0)
    puts("-1");
  else
    for (i = 0; i < n; i++) printf("%d%c", a[i] + 1, i < n - 1 ? ' ' : '\n');
  scanf("%*d");
}
