N,M=map(int,input().split())
s=[list(map(int,input().split()))[1:] for i in range(M)]
p=list(map(int,input().split()))
ans,cnt=0,0
for n in range(2**N):
  for m in range(M):
    cnt=0
    for i in range(N):
      if (n>>i)&1 and i+1 in s[m]:
        cnt+=1
    if cnt%2!=p[m]:
      break
  else:
    ans+=1
print(ans) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M list(map(int,input().split()))[1:] for i in range(M) for i in range(M) i range(M) range M for i in range(M) list(map(int,input().split()))[1:] (map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split 1: 1 s=[list(map(int,input().split()))[1:] for i in range(M)] s [list(map(int,input().split()))[1:] for i in range(M)] p=list(map(int,input().split())) p list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans,cnt=0,0 ans 0 cnt 0 for n in range(2**N):
  for m in range(M):
    cnt=0
    for i in range(N):
      if (n>>i)&1 and i+1 in s[m]:
        cnt+=1
    if cnt%2!=p[m]:
      break
  else:
    ans+=1 n range(2**N) range 2**N 2 N for m in range(M):
    cnt=0
    for i in range(N):
      if (n>>i)&1 and i+1 in s[m]:
        cnt+=1
    if cnt%2!=p[m]:
      break
  else:
    ans+=1 m range(M) range M cnt=0 cnt 0 for i in range(N):
      if (n>>i)&1 and i+1 in s[m]:
        cnt+=1
     i range(N) range N if (n>>i)&1 and i+1 in s[m]:
        cnt+=1
     (n>>i)&1 and i+1 in s[m] (n>>i)&1 n>>i n i 1 i+1 in s[m] i+1 i 1 s[m] s m cnt+=1 cnt 1 if cnt%2!=p[m]:
      break
   cnt%2!=p[m] cnt%2 cnt 2 p[m] p m break ans+=1 ans 1 print(ans) print ans M=map(int,input().split()) map(int,input().split()) M s=[list(map(int,input().split()))[1:] for i in range(M)] [list(map(int,input().split()))[1:] for i in range(M)] s cnt=0,0 0 cnt cnt=0 0 cnt p=list(map(int,input().split())) list(map(int,input().split())) p ans,cnt=0,0 0 ans N,M=map(int,input().split()) map(int,input().split()) N cnt+=1 1 cnt ans+=1 1 ans
N,M=map(int,input().split())
s=[list(map(int,input().split()))[1:] for i in range(M)]
p=list(map(int,input().split()))
ans,cnt=0,0
for n in range(2**N):
  for m in range(M):
    cnt=0
    for i in range(N):
      if (n>>i)&1 and i+1 in s[m]:
        cnt+=1
    if cnt%2!=p[m]:
      break
  else:
    ans+=1
print(ans)