#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> answer;
  vector<pair<int, int> > column;
  int n, m;
  scanf("%d %d", &n, &m);
  answer.resize(n);
  column.resize(m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &(column[i].first));
    column[i].second = i + 1;
  }
  sort(column.rbegin(), column.rend());
  fill(answer.begin(), answer.end(), -1);
  for (int i = 0; i < n; i += 2) {
    for (int j = 0; j < m; j++) {
      if (column[j].first == 0) {
        continue;
      } else {
        if ((column[j].second == answer[(i - 1 + n) % n]) ||
            (column[j].second == answer[(i + 1) % n])) {
          continue;
        } else {
          answer[i] = column[j].second;
          column[j].first--;
          break;
        }
      }
    }
  }
  for (int i = 1; i < n; i += 2) {
    for (int j = 0; j < m; j++) {
      if (column[j].first == 0) {
        continue;
      } else {
        if ((column[j].second == answer[(i - 1 + n) % n]) ||
            (column[j].second == answer[(i + 1) % n])) {
          continue;
        } else {
          answer[i] = column[j].second;
          column[j].first--;
          break;
        }
      }
    }
  }
  if (count(answer.begin(), answer.end(), -1) > 0) {
    printf("-1\n");
  } else {
    for (int i = 0; i < n; i++)
      printf("%d%c", answer[i], ((i == n - 1) ? '\n' : ' '));
  }
  return 0;
}
