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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

import static java.lang.Double.*;
import static java.math.BigInteger.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class Main implements Runnable {
	
	private long start;
	
	private void solve() throws IOException {
//      start = System.currentTimeMillis();
		init();
		readData();
		processing();
	}

	private void processing() {
		if (n == 3) {
			if (m < 3) {
				print(NOSOLUTION);
			}
			else {
				print("1 2 3");
			}
		}
		else {
			if (m == 1 || (m == 2 && n%2 == 1) || badStat()) {
				print(NOSOLUTION);
			}
			else {
				doIt();
				if (!found) {
					print(NOSOLUTION);
				}
			}
		}
	}
	
	private boolean badStat() {
		int sum = 0;
		for (Pair pair: a) {
			sum += pair.count;
		}
		return sum < n;
	}
	
	private int[] answer;
	private boolean found = false;
	
	private void outAnswer() {
		found = true;
		for (int i = 0; i < n; ++i) {
			print(answer[i] + " ");
		}
	}
	
	private void doIt() {
		answer = new int[n];
		sort(a);
		answer[0] = a[0].id;
		a[0].dec();
		a[0].prior = true;
		for (int i = 1; i < n-1; ++i) {
			if (a[0].id != answer[i-1]) {
				answer[i] = a[0].id;
				a[0].dec();
				sort(a);
			}
			else {
				if (a[1].count == 0) {
					return;
				}
				else {
					answer[i] = a[1].id;
					a[1].dec();
					sort(a);
				}
			}
		}
		for (int i = 0; i < m; ++i) {
			if (a[i].count > 0 && a[i].id != answer[0] && a[i].id != answer[n-2]) {
				answer[n-1] = a[i].id;
				outAnswer();
				return;
			}
		}
	}
	private void init() {
	
	}
	
	private void readData() throws IOException {
		n = nextInt();
		m = nextInt();
		a = new Pair[m];
		for (int i = 0; i < m; ++i) {
			a[i] = new Pair(nextInt(), i+1);
		}
	}
	
	private int n;
	private int m;
	private Pair[] a;

	private class Pair implements Comparable<Pair> {
		
		public Pair(int count, int id) {
			this.count = count;
			this.id = id;
			this.prior = false;
		}
		
		@Override
		public int compareTo(Pair o) {
			if (o.count > count) {
				return 1;
			}
			else if (o.count < count) {
				return -1;
			}
			else {
				if (o.prior) {
					return 1;
				}
				else if (prior) {
					return -1;
				}
				else {
					return 0;
				}
			}
		}
		
		public void dec() {
			--count;
		}
		
		public boolean prior;
		public int count;
		public int id;
	}

	private static final int INF = 1000000001;
	private static final String NOSOLUTION = "-1";
	
	public static void main(String[] args) throws InterruptedException {
		new Thread(null, new Runnable() {
			public void run() {
				new Main().run();
			}
		}, "1", 1 << 26).start();
	}	
	
	// @Override
	public void run() {
		try {
			boolean onlineJudge = System.getProperty("ONLINE_JUDGE") != null;
			reader = onlineJudge ? new BufferedReader(new InputStreamReader(
					System.in)) : new BufferedReader(
					new FileReader("input.txt"));
			writer = onlineJudge ? new PrintWriter(new BufferedWriter(
					new OutputStreamWriter(System.out))) : new PrintWriter(
					new BufferedWriter(new FileWriter("output.txt")));
			Locale.setDefault(Locale.US);
			tokenizer = null;
			solve();
			writer.flush();
		} catch (Exception error) {
			error.printStackTrace();
			System.exit(1);
		}
	}
	
	class InputReader {
	       
        public InputReader(InputStream stream) {
            this.stream = stream;
        }
 
        public int read() {
            if (numChars == -1)
                    throw new InputMismatchException();
            if (curChar >= numChars) {
                    curChar = 0;
                    try {
                            numChars = stream.read(buf);
                    } catch (IOException e) {
                            throw new InputMismatchException();
                    }
                    if (numChars <= 0)
                            return -1;
            }
            return buf[curChar++];
        }
 
        public int readInt() {
            int c = read();
            while (isSpaceChar(c))
                    c = read();
            int sgn = 1;
            if (c == '-') {
                    sgn = -1;
                    c = read();
            }
            int res = 0;
            do {
                    if (c < '0' || c > '9')
                            throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public long readLong() {
            int c = read();
            while (isSpaceChar(c))
                    c = read();
            int sgn = 1;
            if (c == '-') {
                    sgn = -1;
                    c = read();
            }
            long res = 0;
            do {
                    if (c < '0' || c > '9')
                            throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                    c = read();
            StringBuffer res = new StringBuffer();
            do {
                    res.appendCodePoint(c);
                    c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
 
        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        private String readLine0() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                    if (c != '\r')
                            buf.appendCodePoint(c);
                    c = read();
            }
            return buf.toString();
        }
 
        public String readLine() {
            String s = readLine0();
            while (s.trim().length() == 0)
                    s = readLine0();
            return s;
        }
 
        public String readLine(boolean ignoreEmptyLines) {
            if (ignoreEmptyLines)
                    return readLine();
            else
                    return readLine0();
        }
 
        public char readCharacter() {
            int c = read();
            while (isSpaceChar(c))
                    c = read();
            return (char) c;
        }
 
        public double readDouble() {
            int c = read();
            while (isSpaceChar(c))
                    c = read();
            int sgn = 1;
            if (c == '-') {
                    sgn = -1;
                    c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                    if (c == 'e' || c == 'E')
                            return res * Math.pow(10, readInt());
                    if (c < '0' || c > '9')
                            throw new InputMismatchException();
                    res *= 10;
                    res += c - '0';
                    c = read();
            }
            if (c == '.') {
                    c = read();
                    double m = 1;
                    while (!isSpaceChar(c)) {
                            if (c == 'e' || c == 'E')
                                    return res * Math.pow(10, readInt());
                            if (c < '0' || c > '9')
                                    throw new InputMismatchException();
                            m /= 10;
                            res += (c - '0') * m;
                            c = read();
                    }
            }
            return res * sgn;
        }
        
        private InputStream stream;
        private byte[] buf = new byte[1<<16];
        private int curChar;
        private int numChars;
	}
	
	private class Parser {

        public Parser(InputStream in) {
           din = new DataInputStream(in);
           buffer = new byte[BUFFER_SIZE];
           bufferPointer = bytesRead = 0;
        }

        public byte c;
        
        public int nextInt() throws IOException {
           int value = 0;
           c = read();
           while (c <= ' ') c = read();
           boolean neg = c == '-';
           if (neg) c = read();
           do {
              value = value*10 + c-48;
              c = read();
           } 
           while (c > ' ');
           if (neg) {
               return -value;
           }
           else {
               return value;
           }
        }

        private void fillBuffer() throws IOException {
           bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
           if (bytesRead == -1) buffer[0] = -1;
        }

        public byte read() throws IOException {
           if (bufferPointer == bytesRead) fillBuffer();
           return buffer[bufferPointer++];
        }

        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;
        
        final private int BUFFER_SIZE = 1 << 16;
    }

	private BufferedReader reader;
	private PrintWriter writer;
	private StringTokenizer tokenizer;

	private void println() {
		writer.println();
	}
	
	private void print(Object obj) {
		writer.print(obj);
	}
	
	private void println(Object obj) {
		writer.println(obj);
	}
	
	private void printf(String f, Object... obj) {
		writer.printf(f, obj);
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}

	private String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
}