n,m=map(int, input().split())
k=[list(map(int, input().split())) for _ in range(m)]
p=list(map(int, input().split()))

ans=0

for i in range(2**n):
    t=0
    for j in range(m):
        o=sum(1 for h in k[j][1:] if i >>(h-1)&1)
        if o%2==p[j]:
            t+=1
    if t==m:
        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())) for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k=[list(map(int, input().split())) for _ in range(m)] k [list(map(int, input().split())) 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):
    t=0
    for j in range(m):
        o=sum(1 for h in k[j][1:] if i >>(h-1)&1)
        if o%2==p[j]:
            t+=1
    if t==m:
        ans+=1 i range(2**n) range 2**n 2 n t=0 t 0 for j in range(m):
        o=sum(1 for h in k[j][1:] if i >>(h-1)&1)
        if o%2==p[j]:
            t+=1
     j range(m) range m o=sum(1 for h in k[j][1:] if i >>(h-1)&1) o sum(1 for h in k[j][1:] if i >>(h-1)&1) sum 1 if o%2==p[j]:
            t+=1
     o%2==p[j] o%2 o 2 p[j] p j t+=1 t 1 if t==m:
        ans+=1 t==m t m ans+=1 ans 1 print(ans) print ans k=[list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] k n,m=map(int, input().split()) map(int, input().split()) n ans=0 0 ans p=list(map(int, input().split())) list(map(int, input().split())) p m=map(int, input().split()) map(int, input().split()) m t=0 0 t o=sum(1 for h in k[j][1:] if i >>(h-1)&1) sum(1 for h in k[j][1:] if i >>(h-1)&1) o t+=1 1 t ans+=1 1 ans
n,m=map(int, input().split())
k=[list(map(int, input().split())) for _ in range(m)]
p=list(map(int, input().split()))

ans=0

for i in range(2**n):
    t=0
    for j in range(m):
        o=sum(1 for h in k[j][1:] if i >>(h-1)&1)
        if o%2==p[j]:
            t+=1
    if t==m:
        ans+=1
print(ans)