N, M = list(map(int, input().split()))
KS = [list(map(int, input().split())) for _ in range(M)]
P = list(map(int, input().split()))

answer = 0
from itertools import product

for sw in product([0, 1], repeat=N):
    for p, ks in zip(P, KS):
        K = ks[0]
        S = ks[1:]
        if sum([sw[s - 1] for s in S]) % 2 != p % 2:
            break
    else:
        answer += 1

print(answer) N, M = list(map(int, input().split())) N list(map(int, input().split())) list 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 KS = [list(map(int, input().split())) for _ in range(M)] KS [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 answer = 0 answer 0 from itertools import product for sw in product([0, 1], repeat=N):
    for p, ks in zip(P, KS):
        K = ks[0]
        S = ks[1:]
        if sum([sw[s - 1] for s in S]) % 2 != p % 2:
            break
    else:
        answer += 1 sw product([0, 1], repeat=N) product [0, 1] 0 1 repeat=N repeat N for p, ks in zip(P, KS):
        K = ks[0]
        S = ks[1:]
        if sum([sw[s - 1] for s in S]) % 2 != p % 2:
            break
    else:
        answer += 1 p ks zip(P, KS) zip P KS K = ks[0] K ks[0] ks 0 S = ks[1:] S ks[1:] ks 1: 1 if sum([sw[s - 1] for s in S]) % 2 != p % 2:
            break
     sum([sw[s - 1] for s in S]) % 2 != p % 2 sum([sw[s - 1] for s in S]) % 2 sum([sw[s - 1] for s in S]) sum [sw[s - 1] for s in S] 2 p % 2 p 2 break answer += 1 answer 1 print(answer) print answer N, M = list(map(int, input().split())) list(map(int, input().split())) N P = list(map(int, input().split())) list(map(int, input().split())) P KS = [list(map(int, input().split())) for _ in range(M)] [list(map(int, input().split())) for _ in range(M)] KS M = list(map(int, input().split())) list(map(int, input().split())) M answer += 1 1 answer answer = 0 0 answer K = ks[0] ks[0] K S = ks[1:] ks[1:] S
N, M = list(map(int, input().split()))
KS = [list(map(int, input().split())) for _ in range(M)]
P = list(map(int, input().split()))

answer = 0
from itertools import product

for sw in product([0, 1], repeat=N):
    for p, ks in zip(P, KS):
        K = ks[0]
        S = ks[1:]
        if sum([sw[s - 1] for s in S]) % 2 != p % 2:
            break
    else:
        answer += 1

print(answer)
