#include <bits/stdc++.h>
using namespace std;
string toString(int val) {
  ostringstream oss;
  oss << val;
  return oss.str();
}
int fromString(const std::string& s) {
  istringstream iss(s);
  int res;
  iss >> res;
  return res;
}
struct alb {
  int fot;
  int num;
  bool first;
};
bool sm(alb a, alb b) {
  return (a.fot > b.fot) || ((a.fot == b.fot) && (a.first));
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<alb> albums(m);
  for (int i = 0; i < m; ++i) {
    cin >> albums[i].fot;
    albums[i].num = i;
    albums[i].first = false;
  }
  vector<int> ans(n, -1);
  sort(albums.begin(), albums.end(), sm);
  ans[0] = albums[0].num;
  --albums[0].fot;
  albums[0].first = true;
  sort(albums.begin(), albums.end(), sm);
  for (int i = 1; i < n - 1; ++i) {
    if (ans[i - 1] == albums[0].num) {
      if (albums[1].fot == 0) {
        cout << "-1";
        return 0;
      } else {
        ans[i] = albums[1].num;
        --albums[1].fot;
      }
    } else {
      if (albums[0].fot == 0) {
        cout << "-1";
        return 0;
      } else {
        ans[i] = albums[0].num;
        --albums[0].fot;
      }
    }
    sort(albums.begin(), albums.end(), sm);
  }
  for (int i = 0; i < m; ++i) {
    if ((ans[n - 2] != albums[i].num) && (ans[0] != albums[i].num) &&
        (albums[i].fot > 0)) {
      ans[n - 1] = albums[i].num;
      --albums[i].fot;
      for (int j = 0; j < n; ++j) {
        cout << ans[j] + 1 << " ";
      }
      return 0;
    }
  }
  cout << "-1";
  return 0;
}
