n,m = map(int,input().split())
light = [list(map(int,input().split()))[1:] for _ in range(m)]
check = list(map(int,input().split()))
ans = 0
for i in range(2**n):
    for j in range(m):
        cnt = 0
        ok = 1
        for k in light[j]:
            if i >> (k-1) & 1 == 1:cnt += 1
        if cnt%2 == check[j]:
            continue
        else:
            ok=0
            break
    ans += ok 
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 light = [list(map(int,input().split()))[1:] for _ in range(m)] light [list(map(int,input().split()))[1:] for _ in range(m)] check = list(map(int,input().split())) check 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):
    for j in range(m):
        cnt = 0
        ok = 1
        for k in light[j]:
            if i >> (k-1) & 1 == 1:cnt += 1
        if cnt%2 == check[j]:
            continue
        else:
            ok=0
            break
    ans += ok  i range(2**n) range 2**n 2 n for j in range(m):
        cnt = 0
        ok = 1
        for k in light[j]:
            if i >> (k-1) & 1 == 1:cnt += 1
        if cnt%2 == check[j]:
            continue
        else:
            ok=0
            break
     j range(m) range m cnt = 0 cnt 0 ok = 1 ok 1 for k in light[j]:
            if i >> (k-1) & 1 == 1:cnt += 1
         k light[j] light j if i >> (k-1) & 1 == 1:cnt += 1
         i >> (k-1) & 1 == 1 i >> (k-1) & 1 i >> (k-1) i k-1 k 1 1 1 if cnt%2 == check[j]:
            continue
        else:
            ok=0
            break
     cnt%2 == check[j] cnt%2 cnt 2 check[j] check j continue ok=0 ok 0 break ans += ok ans ok print(ans) print ans cnt = 0 0 cnt ans = 0 0 ans check = list(map(int,input().split())) list(map(int,input().split())) check n,m = map(int,input().split()) map(int,input().split()) n ok=0 0 ok light = [list(map(int,input().split()))[1:] for _ in range(m)] [list(map(int,input().split()))[1:] for _ in range(m)] light ans += ok ok ans ok = 1 1 ok m = map(int,input().split()) map(int,input().split()) m
n,m = map(int,input().split())
light = [list(map(int,input().split()))[1:] for _ in range(m)]
check = list(map(int,input().split()))
ans = 0
for i in range(2**n):
    for j in range(m):
        cnt = 0
        ok = 1
        for k in light[j]:
            if i >> (k-1) & 1 == 1:cnt += 1
        if cnt%2 == check[j]:
            continue
        else:
            ok=0
            break
    ans += ok 
print(ans)