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

from itertools import product

ans = 0
for a in product([0,1],repeat=n):
    for j,l in enumerate(li):
        t = 0
        for k in l[1:]:
            t += a[k-1]
        t %= 2
        if t != p[j]: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())) 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 li = [list(map(int,input().split())) for _ in range(m)] li [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 from itertools import product ans = 0 ans 0 for a in product([0,1],repeat=n):
    for j,l in enumerate(li):
        t = 0
        for k in l[1:]:
            t += a[k-1]
        t %= 2
        if t != p[j]:break
    else:
        ans += 1 a product([0,1],repeat=n) product [0,1] 0 1 repeat=n repeat n for j,l in enumerate(li):
        t = 0
        for k in l[1:]:
            t += a[k-1]
        t %= 2
        if t != p[j]:break
    else:
        ans += 1 j l enumerate(li) enumerate li t = 0 t 0 for k in l[1:]:
            t += a[k-1]
         k l[1:] l 1: 1 t += a[k-1] t a[k-1] a k-1 k 1 t %= 2 t 2 if t != p[j]:break
     t != p[j] t p[j] p j ans += 1 ans 1 print(ans) print ans ans = 0 0 ans p = list(map(int,input().split())) list(map(int,input().split())) p t = 0 0 t n,m = map(int,input().split()) map(int,input().split()) n t %= 2 2 t ans += 1 1 ans m = map(int,input().split()) map(int,input().split()) m li = [list(map(int,input().split())) for _ in range(m)] [list(map(int,input().split())) for _ in range(m)] li t += a[k-1] a[k-1] t
n,m = map(int,input().split())
li = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))

from itertools import product

ans = 0
for a in product([0,1],repeat=n):
    for j,l in enumerate(li):
        t = 0
        for k in l[1:]:
            t += a[k-1]
        t %= 2
        if t != p[j]:break
    else:
        ans += 1

print(ans)