#include <bits/stdc++.h>
using namespace std;
pair<int, int> A[1010];
int T[1010];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> A[i].first;
    A[i].second = i;
  }
  sort(&A[1], &A[1] + m, greater<pair<int, int> >());
  int k = 1;
  for (int i = 1; i <= n; i += 2) {
    T[i] = A[k].second;
    if (--A[k].first == 0) {
      k++;
      i--;
    }
  }
  if (T[1] == T[n]) {
    T[n] = A[++k].second;
    if (--A[k].first == 0) k++;
  }
  if (k == 1) k++;
  for (int i = 1; i <= n; i++)
    if (T[i] == 0) {
      if (T[i - 1] == A[k].second || A[k].second == T[i + 1]) k++;
      T[i] = A[k].second;
      if (--A[k].first == 0) k++;
    }
  for (int i = 1; i <= n; i++)
    if (T[i] == 0 || T[i - 1] == T[i] || T[i] == T[i + 1]) {
      cout << "-1";
      goto exit;
    }
  if (T[1] == T[n]) {
    cout << "-1";
    goto exit;
  }
  for (int i = 1; i <= n; i++) cout << T[i] << " ";
exit:
  return (0);
}
