#include <bits/stdc++.h>
using namespace std;
int a[42], p[1024], co[42];
typedef struct {
  int num, con;
} data;
data d[41];
priority_queue<data> q;
bool operator<(data x, data y) { return x.con < y.con; }
int main() {
  int n, m, t, cnt, sum = 0, co, temp, right;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
    if (a[i] > n / 2) a[i] = n / 2;
    sum += a[i];
  }
  if (sum < n)
    printf("-1");
  else {
    for (int i = 1; i <= m; i++) {
      d[i].num = i;
      d[i].con = a[i];
      q.push(d[i]);
    }
    right = 0;
    while (right < n) {
      data u = q.top();
      q.pop();
      for (int i = 1; i <= 2 * u.con - 1 && (i + right <= n); i++)
        if (i & 1)
          p[i + right] = u.num;
        else {
          data temp = q.top();
          q.pop();
          p[i + right] = temp.num;
          temp.con--;
          q.push(temp);
        }
      right = min(right + 2 * u.con - 1, n);
    }
    for (int i = 1; i <= n; i++) printf("%d ", p[i]);
  }
  return 0;
}
