#include <bits/stdc++.h>
int n, m, a[1010], b[51];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; ++i) scanf("%d", b + i);
  for (int i = 1; i <= n; ++i) {
    int best = 0;
    for (int j = 1; j <= m; ++j)
      if (b[j] && j != a[i - 1] && (i != n || j != a[1]))
        if (b[j] > b[best])
          best = j;
        else if (b[j] == b[best] && j == a[1])
          best = j;
    if (!best) {
      puts("-1");
      return 0;
    }
    a[i] = best;
    --b[best];
  }
  for (int i = 1; i <= n; ++i) printf("%d ", a[i]);
  return 0;
}
