#include <bits/stdc++.h>
using namespace std;
pair<int, int> a[146], b[146];
int ans[1046];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &a[i].first);
  for (int i = 0; i < m; i++) a[i].second = i;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) b[j] = a[j];
    int last = i;
    ans[0] = i;
    b[i].first--;
    bool f = true;
    for (int j = 1; j < n; j++) {
      int curMax = -1;
      for (int k = 0; k < m; k++)
        if (k != last && b[k].first > 0 &&
            (curMax == -1 || b[k].first > b[curMax].first))
          curMax = k;
      last = curMax;
      if (curMax == -1) {
        f = false;
        break;
      }
      if (b[curMax].first < 0) {
        throw 42;
      }
      b[curMax].first--;
      ans[j] = curMax;
    }
    for (int i = 0; i < n - 1; i++)
      if (ans[i] == ans[i + 1]) f = false;
    if (ans[0] == ans[n - 1]) f = false;
    if (f) {
      for (int i = 0; i < n; i++) {
        printf("%d ", b[ans[i]].second + 1);
      }
      return 0;
    }
  }
  printf("-1");
}
