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.
import java.awt.Point;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class D {

	static int N, M;
	static ArrayList<Point>[] G, T;
	static int[] Tree, val, d;
	static ArrayList<Integer> un;
	static TreeSet<Integer> res;
	static int ov;
	static void dfs(int u, int p, int l) {
		if(d[u] == -1)
			ov = u;
		int curD = 1;
		if(p == -1) {
			curD--;
		}
		L[u] = l;
		Tree[u] = p;
		for(Point nxt: G[u]) {
			int v = nxt.x;
			if(Tree[v] == -2) {
				curD++;
				T[u].add(nxt);
				dfs(v, u, l + 1);
				res.add(nxt.y);
			}
		}

		if(d[u] != -1 && curD % 2 != d[u] %2) 
			un.add(u);
		
	}

	static int dfs2(int u, int p) {
		int ans = 0;
		for(Point nxt : T[u]) {
			int v = nxt.x;
			if(v != p) {
				int cur = dfs2(v, u);
				if(cur % 2 == 1)
					res.remove(nxt.y);
				ans += cur;
			}
		}
		return ans + val[u];
	}

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		N = sc.nextInt();
		M = sc.nextInt();

		d = new int[N];
		G = new ArrayList[N];
		T = new ArrayList[N];
		ArrayList<ArrayList<Integer>> list = new ArrayList<>();
		res = new TreeSet<>();
		Tree = new int[N];
		L = new int[N];
		int[] deg = new int[N];
		val = new int[N];
		for (int i = 0; i < N; i++)
			d[i] = sc.nextInt();


		for (int i = 0; i < N; i++) {
			G[i] = new ArrayList<>();
			T[i] = new ArrayList<>();
		}

		for (int i = 0; i < M; i++) {
			int f = sc.nextInt() - 1;
			int t = sc.nextInt() - 1;
			G[f].add(new Point(t, i));
			G[t].add(new Point(f, i));
			deg[f]++;
			deg[t]++;
		}
		
		Arrays.fill(Tree, -2);
		for (int i = 0; i < N; i++) {
			if(Tree[i] == -2) {
				un = new ArrayList<>();
				ov = -1;
				dfs(i, -1, 0);
				if(un.size() % 2 == 1 && ov != -1) 
					un.add(ov);

				if(un.size() % 2 != 0) {
					out.println(-1);
					out.flush();
					return;
				}
				list.add(un);
			}
		}
		G = null;
		preprocessParents();


		for (int i = 0; i < list.size(); i++) {
			ArrayList<Integer> cur = list.get(i);

			for (int j = 0; j < cur.size(); j+=2) {
				int x = cur.get(j);
				int y = cur.get(j + 1);
				int lca = query(x, y);
				val[x]++;
				val[y]++;
				val[lca]-=2;
			}
		}

		for (int i = 0; i < N; i++) {
			if(Tree[i] == -1)
				dfs2(i, -1);
		}
		out.println(res.size());
		for (int i : res) 
			out.println(i + 1);

		out.flush();
		out.close();
	}

	static int L[], P[][];			// P[i][j] --> the 2^j th ancestor of node i

	static void preprocessParents()	// O(n log n)
	{
		int k = 0; while(1<<k+1 < N) ++k;		// max parent = floor(log2(N - 1))

		P = new int[N][k + 1];

		for(int i = 0; i < N; i++)
			Arrays.fill(P[i], -1);

		// base case: direct parents
		for(int i = 0; i < N; ++i)
			P[i][0] = Tree[i];					// T[root] = -1				

		for(int j = 1; j <= k; j++)			
			for(int i = 0; i < N; i++)
				if(P[i][j-1] != -1)
					P[i][j] = P[P[i][j-1]][j-1];
	}

	static int query(int p, int q)		// O(log n)
	{
		//if p is situated on a higher level than q, swap them
		if (L[p] < L[q]) { p ^= q; q ^= p; p ^= q; }

		//find largest k such that 2^k is a parent of p
		int k = 0;
		while(1<<k+1 <= L[p])
			++k;

		//find the ancestor of p situated on the same level with q
		for (int i = k; i >= 0; --i)
			if (L[p] - (1<<i) >= L[q])
				p = P[p][i];

		if (p == q)
			return p;

		//go up to lowest (non-common) ancestors for p and q
		for (int i = k; i >= 0; --i)
			if (P[p][i] != -1 && P[p][i] != P[q][i])
			{
				p = P[p][i]; q = P[q][i];
			}

		return P[p][0];
	} 

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
		public Scanner(String file) throws FileNotFoundException{	br = new BufferedReader(new FileReader(file));}


		public String next() throws IOException {
			while(st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public int nextInt() throws NumberFormatException, IOException {
			return Integer.parseInt(next());
		}
		public long nextLong() throws NumberFormatException, IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

	}

}

