#include <bits/stdc++.h>
using namespace std;
const long double EPS = 0.00001;
const long double PI = 3.14159265358979323846;
inline void file_io(string in_file, string out_file, bool mark) {
  if (!mark) return;
  freopen(in_file.c_str(), "r", stdin);
  freopen(out_file.c_str(), "w", stdout);
}
inline void ext() {
  cout << -1 << endl;
  exit(0);
}
int main() {
  file_io("input.in", "output.out", 0);
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  if (m == 1) ext();
  vector<pair<int, int> > alb(m);
  vector<int> ans(n);
  for (int i = 0; i < m; ++i) cin >> alb[i].first, alb[i].second = i + 1;
  for (int i = 0; i < n - 1; ++i) {
    sort(alb.rbegin(), alb.rend());
    if (i == 0) {
      ans[i] = alb[0].second;
      alb[0].first--;
      continue;
    }
    int choise = -1;
    for (int j = 0; j < m; ++j) {
      if (alb[j].first && alb[j].second != ans[i - 1]) {
        choise = j;
        break;
      }
    }
    if (choise == -1) ext();
    for (int j = 0; j < m; ++j)
      if (alb[j].first == alb[choise].first && alb[j].second == ans[0] &&
          ans[i - 1] != ans[0])
        choise = j;
    alb[choise].first--;
    ans[i] = alb[choise].second;
  }
  for (int j = 0; j < m; ++j)
    if (alb[j].first && alb[j].second != ans[0] && alb[j].second != ans[n - 2])
      ans[n - 1] = alb[j].second;
  if (ans[n - 1] == 0) ext();
  for (int i = 0; i < n; ++i) cout << ans[i] << " ";
  return EXIT_SUCCESS;
}
