Problem: Polycarp loves not only to take pictures, but also to show his photos to friends. On his personal website he has recently installed a widget that can display n photos with the scroll option. At each moment of time the widget displays exactly one photograph with the option showing the previous/next one. From the first photo, you can switch to the second one or to the n-th one, from the second photo you can switch to the third one or to the first one, etc. Thus, navigation is performed in a cycle.

Polycarp's collection consists of m photo albums, the i-th album contains ai photos. Polycarp wants to choose n photos and put them on a new widget. To make watching the photos interesting to the visitors, he is going to post pictures so that no two photos from one album were neighboring (each photo will have exactly two neighbors, the first photo's neighbors are the second and the n-th one).

Help Polycarp compile a photo gallery. Select n photos from his collection and put them in such order that no two photos from one album went one after the other.

Input

The first line contains two integers n and m (3 ≤ n ≤ 1000, 1 ≤ m ≤ 40), where n is the number of photos on the widget, and m is the number of albums. The second line contains m integers a1, a2, ..., am (1 ≤ ai ≤ 1000), where ai is the number of photos in the i-th album.

Output

Print the single number -1 if there is no solution. Otherwise, print n numbers t1, t2, ..., tn, where ti represents the number of the album of the i-th picture in the widget. The albums are numbered from 1 in the order of their appearance in the input. If there are several solutions, print any of them.

Examples

Input

4 3
1 3 5


Output

3 1 3 2


Input

10 2
5 5


Output

2 1 2 1 2 1 2 1 2 1


Input

10 3
1 10 3


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
struct NN {
  int v, dex;
};
NN aa[50];
int L[50], R[50];
NN key[50];
int sta[1010], top;
int ans[1010];
bool cmp(const NN &cmp1, const NN &cmp2) { return cmp1.v < cmp2.v; }
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &aa[i].v);
    aa[i].dex = i;
  }
  sort(aa + 1, aa + m + 1, cmp);
  for (int i = 0; i <= m; i++) {
    L[i] = i - 1;
    R[i] = i + 1;
    key[i] = aa[i];
  }
  L[0] = m;
  R[m] = 0;
  if (m == 1) {
    printf("-1\n");
  } else {
    top = 0;
    while (true) {
      int a, b;
      if (L[0] == 0 || L[L[0]] == 0) {
        break;
      }
      a = L[L[0]];
      b = L[0];
      while (top + 1 < n && key[a].v > 0) {
        sta[top++] = key[b].dex;
        sta[top++] = key[a].dex;
        key[a].v--;
        key[b].v--;
      }
      if (top == n) {
        if (sta[top - 1] == sta[0]) {
          top--;
          key[a].v++;
        }
        break;
      }
      if (top + 1 == n) break;
      int c = L[L[L[0]]];
      R[c] = 0;
      L[0] = c;
      if (key[b].v != 0) {
        while (c != 0 && key[c].v > key[b].v) {
          c = L[c];
        }
        R[b] = R[c];
        L[b] = c;
        L[R[c]] = b;
        R[c] = b;
      }
    }
    if (top < n) {
      if (top + 1 == n) {
        int cc = -1;
        int id;
        for (int i = 0; i < top; i++) {
          bool ok = false;
          for (int j = R[0]; j != 0; j = R[j]) {
            if (key[j].v != 0 && key[j].dex != sta[(i - 1 + top) % top] &&
                key[j].dex != sta[i]) {
              ok = true;
              id = key[j].dex;
              break;
            }
          }
          if (ok) {
            cc = i;
            break;
          }
        }
        if (cc != -1) {
          for (int i = 0; i < cc; i++) ans[i] = sta[i];
          ans[cc] = id;
          for (int i = cc; i < top; i++) {
            ans[i + 1] = sta[i];
          }
          for (int i = 0; i < n; i++) {
            printf("%d", ans[i]);
            if (i != n - 1) printf(" ");
          }
          printf("\n");
        } else {
          printf("-1\n");
        }
      } else {
        if (L[0] == 0) {
          printf("-1\n");
        } else {
          int cc = 0;
          int a = L[0];
          int id = -1;
          for (int i = 0; i < top; i++) {
            if (key[a].v != 0 && key[a].dex != sta[(i - 1 + top) % 2] &&
                key[a].dex != sta[i]) {
              ans[cc++] = key[a].dex;
              ans[cc++] = sta[i];
              key[a].v--;
              if (cc + (top - i - 1) == n) {
                id = i + 1;
                break;
              }
            }
          }
          if (id != -1) {
            for (int i = id; i < top; i++) {
              ans[cc++] = sta[i];
            }
          }
          if (cc == n) {
            for (int i = 0; i < n; i++) {
              printf("%d", ans[i]);
              if (i != n - 1) printf(" ");
            }
            printf("\n");
          } else {
            printf("-1\n");
          }
        }
      }
    } else {
      for (int i = 0; i < n; i++) {
        printf("%d", sta[i]);
        if (i != n - 1) printf(" ");
      }
      printf("\n");
    }
  }
  return 0;
}