#include <bits/stdc++.h>
using namespace std;
const int inf = 1000 * 1000 * 1000;
int n, m;
int ar[50];
int res[1009];
vector<pair<int, int> > v;
int main() {
  scanf("%d%d", &n, &m);
  int S = 0;
  for (int i = 0; i < m; i++) {
    scanf("%d", &ar[i]);
    S += ar[i];
    v.push_back(make_pair(ar[i], i));
  }
  if (S < n || m == 1) {
    printf("-1\n");
    return 0;
  }
  sort(v.rbegin(), v.rend());
  memset(res, -1, sizeof(res));
  ;
  for (int i = 0; i < v.size(); i++) {
    if (i == 0) {
      for (int j = 0; j < n; j++) {
        if (res[j] != -1 || v[i].first == 0) continue;
        if (i == 0 && j == n - 1) continue;
        if (j == 0 || j > 0 && res[j - 1] != v[i].second) {
          res[j] = v[i].second;
          v[i].first--;
        }
      }
    } else {
      for (int j = n - 1; j >= 0; j--) {
        if (res[j] != -1 || v[i].first == 0) continue;
        if (j == n - 1 || j < n - 1 && res[j + 1] != v[i].second) {
          res[j] = v[i].second;
          v[i].first--;
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (res[i] == -1) {
      printf("-1\n");
      return 0;
    }
  }
  for (int i = 0; i < n; i++) printf("%d ", res[i] + 1);
  return 0;
}
