#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double PI = 2 * acos(0.0);
const double EPS = 1e-8;
const int INF = 1000000000;
int n, m, s;
int a[50];
int ans[1000];
int getmax() {
  int res = 0;
  for (int i = (int)(0); i < (int)(m); ++i)
    if (a[i] > a[res]) res = i;
  return res;
};
void recit(int p) {
  if (p == n) {
    if (ans[0] != ans[n - 1]) {
      for (int i = (int)(0); i < (int)(n); ++i) printf("%d ", ans[i] + 1);
      exit(0);
    };
    return;
  };
  if (a[getmax()] > (n - p) / 2 + (n - p) % 2) return;
  for (int i = (int)(0); i < (int)(m); ++i)
    if (a[i])
      if (ans[p - 1] != i) {
        --a[i];
        ans[p] = i;
        recit(p + 1);
        ++a[i];
      };
};
int main() {
  cin >> n >> m;
  for (int i = (int)(0); i < (int)(m); ++i) {
    cin >> a[i];
    s += a[i];
  };
  while (s > n) {
    int i = getmax();
    --s;
    --a[i];
  };
  if (s < n || 2 * a[getmax()] > n) {
    printf("-1");
    return 0;
  };
  int i = 0;
  while (a[i] == 0) ++i;
  ans[0] = i;
  --a[i];
  recit(1);
  printf("-1");
  return 0;
};
