#include <bits/stdc++.h>
using namespace std;
vector<int> S;
inline bool cmp(const int &first, const int &second) {
  return S[first] > S[second];
}
int main(int argc, char **argv) {
  int N, M, sum = 0;
  cin >> N >> M;
  S = vector<int>(M);
  for (int i = (0); i < (M); ++i) cin >> S[i];
  int ptr[M];
  for (int i = (0); i < (M); ++i) ptr[i] = i;
  sort(ptr, ptr + M, cmp);
  int used[N];
  memset(used, 0, sizeof(used));
  if (N % 2 == 0) {
    for (int i = (0); i < (N); i += (2))
      for (int k = (0); k < (M); ++k) {
        int j = ptr[k];
        if (S[j]) {
          int next = (i + 1) % N, prev = (i + N - 1) % N;
          if (used[next] != j + 1 && used[prev] != j + 1) {
            used[i] = j + 1, S[j]--;
            break;
          }
        }
      }
    for (int i = (1); i < (N); i += (2))
      for (int k = (0); k < (M); ++k) {
        int j = ptr[k];
        if (S[j]) {
          int next = (i + 1) % N, prev = (i + N - 1) % N;
          if (used[next] != j + 1 && used[prev] != j + 1) {
            used[i] = j + 1, S[j]--;
            break;
          }
        }
      }
    bool ok = 1;
    for (int i = (0); i < (N) && (ok); ++i)
      if (!used[i]) ok = 0;
    if (!ok) {
      puts("-1");
      return 0;
    }
    for (int i = (0); i < (N); ++i) printf("%d ", used[i]);
    puts("");
  } else {
    used[0] = ptr[M - 1] + 1;
    S[ptr[M - 1]]--;
    for (int i = (2); i < (N); i += (2))
      for (int k = (0); k < (M); ++k) {
        int j = ptr[k];
        if (S[j]) {
          int next = (i + 1) % N, prev = (i + N - 1) % N;
          if (used[next] != j + 1 && used[prev] != j + 1) {
            used[i] = j + 1, S[j]--;
            break;
          }
        }
      }
    for (int i = (1); i < (N); i += (2))
      for (int k = (0); k < (M); ++k) {
        int j = ptr[k];
        if (S[j]) {
          int next = (i + 1) % N, prev = (i + N - 1) % N;
          if (used[next] != j + 1 && used[prev] != j + 1) {
            used[i] = j + 1, S[j]--;
            break;
          }
        }
      }
    bool ok = 1;
    for (int i = (0); i < (N) && (ok); ++i)
      if (!used[i]) ok = 0;
    if (!ok) {
      puts("-1");
      return 0;
    }
    for (int i = (0); i < (N); ++i) printf("%d ", used[i]);
    puts("");
  }
  return 0;
}
