3 2
1 0 1
1 2
2 3
 10 10
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
6 7
8 3
6 4
4 2
9 2
5 10
9 8
10 7
5 1
6 2

2
1
2
 0

import math as mt 
import sys,string
input=sys.stdin.readline
from collections import defaultdict
L=lambda : list(map(int,input().split()))
Ls=lambda : list(input().split())
M=lambda : map(int,input().split())
I=lambda :int(input())



n,m=M()
l=L()
if(m==0):
    if(l.count(1)==0):
        print(0)
        exit()
    else:
        print(-1)
        exit()
else:
    if(l.count(1)==0):
        print(0)
        exit()
        
    else:
        x=[]
        y=defaultdict(list)
        h=defaultdict(list)
        v=defaultdict(int)
        for i in range(m):
            a,b=M()
            if(l[a-1]!=1 and l[b-1]!=1):
                if(v[(a,b)]==0):
                    x.append((a,b,i))
                    v[(a,b)]=1
            p=[l[a-1]%2,l[b-1]%2]
            
            p.sort()
            if(p==[1,1] or p==[-1,-1] or p==[-1,1]):
                
                print(1)
                print(i+1)
                exit()
            if(p==[0,1]):
                
                if(l[a-1]==0):
                    y[a].append(i+1)
                    
                    if(len(y[a])==2):
                        print(2)
                        print(*y[a])
                        exit()
                else:
                    y[b].append(i+1)
                    if(len(y[b])==2):
                        print(2)
                        print(*y[b])
                    

            if(p==[-1,0]):
                if(l[a-1]==0):
                    y[a].append(i+1)
                    if(len(y[a])==2):
                        print(2)
                        print(*y[a])
                        exit()
                else:
                    y[b].append(i+1)
                    if(len(y[b])==2):
                        print(2)
                        print(*y[b])
                        exit()
            if(p==[0,0]):
                j=[a,b]
                j.sort()
                h[j[0]].append(i+1)
                if(len(h[j[0]])==2):
                    print(2)
                    print(*h[j[0]])
                    exit()
        else:
            print(-1)
            
                       
    


    
