#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double eps = 1e-9;
int n, m, ans[1003];
pair<int, int> var[50];
int next(int p) {
  if (p == n) return ans[1];
  return ans[p + 1];
}
int pre(int p) {
  if (p == 1) return ans[n];
  return ans[p - 1];
}
int ok;
void process() {
  int end = n / 2 * 2;
  for (int p = m - 1; p >= 0;) {
    for (int i = 1; i <= n; i += 2) {
      if (ans[i]) continue;
      int j = i;
      while (j <= n && var[p].first && next(j) != var[p].second &&
             pre(j) != var[p].second) {
        ans[j] = var[p].second;
        ++ok;
        --var[p].first;
        j += 2;
      }
    }
    --p;
    if (p < 0) break;
    for (int i = end; i >= 1; i -= 2) {
      if (ans[i]) continue;
      int j = i;
      while (j >= 1 && var[p].first && next(j) != var[p].second &&
             pre(j) != var[p].second) {
        ans[j] = var[p].second;
        ++ok;
        --var[p].first;
        j -= 2;
      }
    }
    --p;
  }
  for (int i = 1; i <= n; ++i) {
    if (!ans[i]) {
      for (int j = 0; j < m; ++j) {
        if (var[j].first) {
          if (next(i) != var[j].second && pre(i) != var[j].second) {
            ans[i] = var[j].second;
            --var[j].first;
            ++ok;
          }
        }
      }
    }
  }
}
int main() {
  while (scanf("%d %d", &n, &m) != EOF) {
    for (int i = 0; i < m; ++i) {
      scanf("%d", &var[i].first);
      var[i].second = i + 1;
    }
    sort(var, var + m);
    memset(ans, 0, sizeof(ans));
    ok = 0;
    process();
    if (ok < n)
      puts("-1");
    else {
      printf("%d", ans[1]);
      for (int i = 2; i <= n; ++i) {
        printf(" %d", ans[i]);
      }
      putchar(10);
    }
  }
  return 0;
}
