N, M = map(int, input().split())
lights = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
ans = 0

for i in range(1<<N):
    on = 0
    onoff = bin(i)[2:].zfill(N)
    for j, switches in enumerate(lights):
        if sum(onoff[s-1] == '1' for s in switches[1:]) % 2 == p[j]:
            on += 1
    if on == 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 lights = [list(map(int, input().split())) for _ in range(M)] lights [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(1<<N):
    on = 0
    onoff = bin(i)[2:].zfill(N)
    for j, switches in enumerate(lights):
        if sum(onoff[s-1] == '1' for s in switches[1:]) % 2 == p[j]:
            on += 1
    if on == M:
        ans += 1 i range(1<<N) range 1<<N 1 N on = 0 on 0 onoff = bin(i)[2:].zfill(N) onoff bin(i)[2:].zfill(N) [2:].zfill [2:] (i) bin i 2: 2 zfill N for j, switches in enumerate(lights):
        if sum(onoff[s-1] == '1' for s in switches[1:]) % 2 == p[j]:
            on += 1
     j switches enumerate(lights) enumerate lights if sum(onoff[s-1] == '1' for s in switches[1:]) % 2 == p[j]:
            on += 1
     sum(onoff[s-1] == '1' for s in switches[1:]) % 2 == p[j] sum(onoff[s-1] == '1' for s in switches[1:]) % 2 sum(onoff[s-1] == '1' for s in switches[1:]) sum onoff[s-1] == '1' onoff[s-1] onoff s-1 s 1 '1' 2 p[j] p j on += 1 on 1 if on == M:
        ans += 1 on == M on M ans += 1 ans 1 print(ans) print ans on = 0 0 on ans += 1 1 ans ans = 0 0 ans N, M = map(int, input().split()) map(int, input().split()) N lights = [list(map(int, input().split())) for _ in range(M)] [list(map(int, input().split())) for _ in range(M)] lights M = map(int, input().split()) map(int, input().split()) M onoff = bin(i)[2:].zfill(N) bin(i)[2:].zfill(N) onoff p = list(map(int, input().split())) list(map(int, input().split())) p on += 1 1 on
N, M = map(int, input().split())
lights = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
ans = 0

for i in range(1<<N):
    on = 0
    onoff = bin(i)[2:].zfill(N)
    for j, switches in enumerate(lights):
        if sum(onoff[s-1] == '1' for s in switches[1:]) % 2 == p[j]:
            on += 1
    if on == M:
        ans += 1

print(ans)