n,m=map(int,input().split())
s=[list(map(int,input().split()))[1:] for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    tmp=[]
    for j in range(n):
        if (i>>j)&1:
            tmp.append(j+1)
    for k in range(m):
        if len(set(tmp)&set(s[k]))%2!=p[k]:
            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 _ in range(m) for _ in range(m) _ range(m) range m for _ 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 _ in range(m)] s [list(map(int,input().split()))[1:] for _ 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=0 ans 0 for i in range(2**n):
    tmp=[]
    for j in range(n):
        if (i>>j)&1:
            tmp.append(j+1)
    for k in range(m):
        if len(set(tmp)&set(s[k]))%2!=p[k]:
            break
    else:
        ans+=1 i range(2**n) range 2**n 2 n tmp=[] tmp [] for j in range(n):
        if (i>>j)&1:
            tmp.append(j+1)
     j range(n) range n if (i>>j)&1:
            tmp.append(j+1)
     (i>>j)&1 i>>j i j 1 tmp.append(j+1) tmp.append tmp append j+1 j 1 for k in range(m):
        if len(set(tmp)&set(s[k]))%2!=p[k]:
            break
    else:
        ans+=1 k range(m) range m if len(set(tmp)&set(s[k]))%2!=p[k]:
            break
     len(set(tmp)&set(s[k]))%2!=p[k] len(set(tmp)&set(s[k]))%2 len(set(tmp)&set(s[k])) len set(tmp)&set(s[k]) set(tmp) set tmp set(s[k]) set s[k] s k 2 p[k] p k break ans+=1 ans 1 print(ans) print ans m=map(int,input().split()) map(int,input().split()) m ans+=1 1 ans tmp=[] [] tmp ans=0 0 ans n,m=map(int,input().split()) map(int,input().split()) n s=[list(map(int,input().split()))[1:] for _ in range(m)] [list(map(int,input().split()))[1:] for _ in range(m)] s p=list(map(int,input().split())) list(map(int,input().split())) p
n,m=map(int,input().split())
s=[list(map(int,input().split()))[1:] for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    tmp=[]
    for j in range(n):
        if (i>>j)&1:
            tmp.append(j+1)
    for k in range(m):
        if len(set(tmp)&set(s[k]))%2!=p[k]:
            break
    else:
        ans+=1
print(ans)