#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[100];
int sol[1000000];
void prueba(int ind) {
  sol[0] = ind;
  priority_queue<pair<int, int> > q;
  for (int i = 1; i <= m; i++) {
    if (ind == i) {
      if (a[i] > 1) q.push(pair<int, int>(a[i] - 1, i));
    } else {
      q.push(pair<int, int>(a[i], i));
    }
  }
  for (int i = 1; i < n; i++) {
    pair<int, int> p = q.top();
    q.pop();
    if (i < n - 1) {
      if (p.second != sol[i - 1]) {
        sol[i] = p.second;
        p.first--;
        if (p.first) q.push(p);
      } else if (int(q.size()) == 0) {
        return;
      } else {
        pair<int, int> pbis = q.top();
        q.pop();
        sol[i] = pbis.second;
        pbis.first--;
        if (pbis.first) q.push(pbis);
        q.push(p);
      }
    } else {
      if (p.second != sol[i - 1] and p.second != sol[0]) {
        sol[i] = p.second;
        p.first--;
        if (p.first) q.push(p);
      } else if (int(q.size()) == 0) {
        return;
      } else {
        pair<int, int> pbis = q.top();
        q.pop();
        if (pbis.second != sol[i - 1] and pbis.second != sol[0]) {
          sol[i] = pbis.second;
          pbis.first--;
          if (pbis.first) q.push(pbis);
          q.push(p);
        } else if (int(q.size()) == 0) {
          return;
        } else {
          pair<int, int> pbisbis = q.top();
          q.pop();
          sol[i] = pbisbis.second;
          pbisbis.first--;
          if (pbisbis.first) q.push(pbisbis);
          q.push(p);
          q.push(pbis);
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (i > 0) cout << " ";
    cout << sol[i];
  }
  cout << endl;
  exit(0);
}
int main() {
  cin >> n >> m;
  int suma = 0;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
    suma += a[i];
  }
  if (suma < n) {
    cout << -1 << endl;
    exit(0);
  }
  for (int i = 1; i <= m; i++) prueba(i);
  cout << -1 << endl;
}
