Problem: Leha plays a computer game, where is on each level is given a connected graph with n vertices and m edges. Graph can contain multiple edges, but can not contain self loops. Each vertex has an integer di, which can be equal to 0, 1 or  - 1. To pass the level, he needs to find a «good» subset of edges of the graph or say, that it doesn't exist. Subset is called «good», if by by leaving only edges from this subset in the original graph, we obtain the following: for every vertex i, di = - 1 or it's degree modulo 2 is equal to di. Leha wants to pass the game as soon as possible and ask you to help him. In case of multiple correct answers, print any of them.

Input

The first line contains two integers n, m (1 ≤ n ≤ 3·105, n - 1 ≤ m ≤ 3·105) — number of vertices and edges.

The second line contains n integers d1, d2, ..., dn ( - 1 ≤ di ≤ 1) — numbers on the vertices.

Each of the next m lines contains two integers u and v (1 ≤ u, v ≤ n) — edges. It's guaranteed, that graph in the input is connected.

Output

Print  - 1 in a single line, if solution doesn't exist. Otherwise in the first line k — number of edges in a subset. In the next k lines indexes of edges. Edges are numerated in order as they are given in the input, starting from 1.

Examples

Input

1 0
1


Output

-1


Input

4 5
0 0 0 -1
1 2
2 3
3 4
1 4
2 4


Output

0


Input

2 1
1 1
1 2


Output

1
1


Input

3 3
0 -1 1
1 2
2 3
1 3


Output

1
2

Note

In the first sample we have single vertex without edges. It's degree is 0 and we can not get 1.

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

public class Codeforces841D {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter pw = new PrintWriter(System.out);
		String[] sp = br.readLine().split(" ");
		int n = Integer.parseInt(sp[0]);
		int m = Integer.parseInt(sp[1]);
		sp = br.readLine().split(" ");
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			d[i] = Integer.parseInt(sp[i]);
		}
		int[][] edges = new int[m][3];
		for (int i = 0; i < m; i++) {
			sp = br.readLine().split(" ");
			int a = Integer.parseInt(sp[0]);
			int b = Integer.parseInt(sp[1]);
			edges[i][0] = Math.min(a, b)-1;
			edges[i][1] = Math.max(a, b)-1;
			edges[i][2] = i;
		}
		int[][] adjacency = toadjacency(edges, n);
		int[][] pointer = BFSsearch(adjacency, n, 0);
		boolean negative = false;
		int counter = 0;
		int val = -1;
		for (int i = 0; i < n; i++) {
			if (d[i] == -1) {
				if (!negative) {
					negative = true;
					val = i;
				}
				else {
					d[i] = 0;
				}
			}
			else {
				counter += d[i];
			}
		}
		boolean thing = true;
		if (val == -1) {
			if (counter%2 == 1) {
				System.out.println(-1);
				thing = false;
			}
		}
		else {
			d[val] = counter%2;
		}
		if (thing) {
			int[] e = new int[n];
			int[][] edge = new int[m][2];
			int counter2 = 0;
			for (int i = n-1; (i > 0) && (counter2 < m); i--) {
				if (d[pointer[i][0]] != e[pointer[i][0]]) {
					e[pointer[i][0]] = (e[pointer[i][0]]+1)%2;
					e[pointer[i][1]] = (e[pointer[i][1]]+1)%2;
					edge[counter2][0] = Math.min(pointer[i][0], pointer[i][1]);
					edge[counter2][1] = Math.max(pointer[i][0], pointer[i][1]);
					counter2++;
				}
			}

			pw.println(counter2);
			int[][] edges2 = keysort(edges, 1);
			int[][] edges3 = keysort(edges2, 0);
			int[] edges4 = new int[counter2];
			for (int i = 0; i < counter2; i++) {
				edges4[i] = edges3[findIndex(edge[i], edges3)][2];
			}
			for (int i = 0; i < counter2; i++) {
				pw.println(edges4[i]+1);
			}
		}
		pw.close();

	}
	
	public static int[][] toadjacency(int[][] list, int v) {
		int[] counter = new int[v];
		int n = list.length;
		for (int i = 0; i < n; i++) {
			counter[list[i][0]]++;
			counter[list[i][1]]++;
		}
		int[][] adjacency = new int[v][];
		for (int i = 0; i < v; i++) {
			adjacency[i] = new int[counter[i]];
		}
		int[] counter2 = new int[v];
		for (int i = 0; i < n; i++) {
			adjacency[list[i][0]][counter2[list[i][0]]] = list[i][1];
			counter2[list[i][0]]++;
			adjacency[list[i][1]][counter2[list[i][1]]] = list[i][0];
			counter2[list[i][1]]++;
		}
		
		return adjacency;
	}
	
	public static int[][] BFSsearch (int[][] adjacency, int v, int index) {
		boolean[] found = new boolean[v];
		found[index] = true;
		int[][] indexList = new int[v][2];
		int start = 0;
		int end = 1;
		indexList[0][0] = index;
		indexList[0][1] = index;
		while ((end < v) && (start < end)) {
			for (int i = 0; i < adjacency[indexList[start][0]].length; i++) {
				if (found[adjacency[indexList[start][0]][i]] == false) {
					found[adjacency[indexList[start][0]][i]] = true;
					indexList[end][0] = adjacency[indexList[start][0]][i];
					indexList[end][1] = indexList[start][0];
					end++;
				}
			}
			start++;
		}
		return indexList;
	}
	
	public static int findIndex(int[] n, int[][] list) {
		int r = list.length;
		if ((n[0] > list[r-1][0]) || ((n[0] == list[r-1][0]) && (n[1] > list[r-1][1])))
			return r;
		else {
			int low = 0;
			int high = r-1;
			int val = 0;
			while (low <= high) {
				val = (low+high)/2;
				if ((list[val][0] == n[0]) && (list[val][1] == n[1]))
					return val;
				else if ((list[val][0] > n[0]) || ((list[val][0] == n[0]) && (list[val][1] > n[1])))
					high = val-1;
				else
					low = val+1;
			}
			return low;
		}
	}
	
	public static int[][] keysort(int[][] lst, int key) {
		int n = lst.length;
		if (n == 1) {
			return lst;
		}
		int m = n/2;
		int[][] lst1 = keysort(Arrays.copyOfRange(lst, 0, m), key);
		int[][] lst2 = keysort(Arrays.copyOfRange(lst, m, n), key);
		int[][] lstNew = new int[n][2];
		int counter1 = 0;
		int counter2 = 0;
		while ((counter1 < m) && (counter2 < n-m)) {
			if (lst1[counter1][key] <= lst2[counter2][key]) {
				lstNew[counter1+counter2] = lst1[counter1];
				counter1++;
			}
			else {
				lstNew[counter1+counter2] = lst2[counter2];
				counter2++;
			}
		}
		
		while (counter1 < m) {
			lstNew[counter1+counter2] = lst1[counter1];
			counter1++;
		}
		
		while (counter2 < n-m) {
			lstNew[counter1+counter2] = lst2[counter2];
			counter2++;
		}
		
		return lstNew;
	}

}