import sequtils,strutils,algorithm proc r():any=stdin.readLine.parseInt proc R():any=stdin.readLine.split.map(parseInt) var N=r() K=1 shl N A=R() M=r() B=R() S=newSeq[int]K for n in 0..=0) if ans[K-1]:quit "1",0 for i,b in B[1..^1]: var n_ans = S.mapIt(false) for x,a in ans: if a: for y,s in S: if (x and y)==0 and b-s>=0:n_ans[x xor y]=true ans = n_ans if ans[K-1] : quit $(i+2),0 echo -1