#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 100;
long long n, m, x, y, cnt, vis, s;
pair<long long, long long> p[N];
vector<long long> v, ans;
bool check() {
  cnt = 0;
  for (int i = 1; i < m; i++) cnt += p[i].first;
  if ((p[0].first > cnt && cnt * 2 + 1 < n) || cnt + p[0].first < n ||
      (n % 2 == 1 && m == 2))
    return 0;
  return 1;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  long long nn = n;
  for (int i = 0; i < m; i++) {
    cin >> p[i].first;
    p[i].second = i + 1;
  }
  sort(p, p + m, greater<pair<int, int>>());
  if (!check()) return cout << -1, 0;
  if (p[m - 1].first * 2 > n && n % 2 == 1)
    v.push_back(p[1].second), p[1].first--;
  else
    v.push_back(p[m - 1].second), p[m - 1].first--;
  n--, cnt = 0, y = m - 1;
  while (n) {
    n--, cnt++;
    if (cnt % 2 == 1) {
      if (p[x].first == 0) x++;
      if (x != y) v.push_back(p[x].second), p[x].first--;
    } else {
      if (p[y].first == 0) y--;
      if (x != y) v.push_back(p[y].second), p[y].first--;
    }
  }
  if (v.size() != nn) {
    for (int i = 0; i < m; i++)
      if (p[i].first != 0) vis = i;
    if (v[v.size() - 1] != p[vis].second)
      v.push_back(p[vis].second), p[vis].first--;
    if (p[vis].first) {
      for (auto u : v) {
        if (s % 2 == 1 && p[vis].first)
          ans.push_back(p[vis].second), p[vis].first--;
        ans.push_back(u), s++;
      }
      for (int i = 0; i < nn; i++) cout << ans[i] << " ";
      return 0;
    }
  }
  for (int i = 0; i < nn; i++) cout << v[i] << " ";
  return 0;
}
