#include <bits/stdc++.h>
using namespace std;
pair<int, int> x[200000];
int ans[10000];
int main() {
  int n, m;
  cin >> m >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i].first;
    x[i].second = i;
  }
  ans[0] = -1;
  ans[1] = -1;
  ans[m] = -1;
  for (int j = 1; j <= m; j++) {
    sort(x, x + n);
    for (int i = n - 1; i >= 0; i--)
      if (ans[j - 1] != x[i].second && x[i].first > 0) {
        x[i].first--;
        ans[j] = x[i].second;
        break;
      }
  }
  if (ans[m] == -1) {
    cout << -1 << endl;
    return 0;
  }
  int i = 1;
  if (ans[i] == ans[m]) {
    for (int j = 0; j < n; j++)
      if (x[j].first > 0 && x[j].second != ans[m] && x[j].second != ans[2]) {
        ans[i] = x[j].second;
        x[j].first--;
        break;
      }
  }
  i = m;
  if (ans[i] == ans[1]) {
    for (int j = 0; j < n; j++)
      if (x[j].first > 0 && x[j].second != ans[i] &&
          x[j].second != ans[m - 1]) {
        ans[i] = x[j].second;
        x[j].first--;
        break;
      }
  }
  if (ans[1] == ans[m]) {
    swap(ans[m], ans[m - 1]);
    ans[m + 1] = -1;
    for (int i = 1; i <= m; i++)
      if (ans[i] == ans[i - 1] || ans[i] == ans[i + 1]) {
        for (int j = 0; j < n; j++)
          if (x[j].first > 0 && x[j].second != ans[i - 1]) {
            ans[i] = x[j].second;
            x[j].first--;
            break;
          }
      }
  }
  for (int i = 2; i <= m; i++)
    if (ans[i] == ans[i - 1] || ans[1] == ans[m]) {
      cout << -1 << endl;
      return 0;
    }
  for (int i = 1; i <= m; i++) cout << ans[i] + 1 << " ";
  return 0;
}
