N, M = map(int, input().split())
k = [0] * M
s = [0] * M
for i in range(M):
    s[i] = list(map(int, input().split()))
    k[i] = s[i].pop(0)
p = list(map(int, input().split()))

ans = 0

for i in range(2**N):
    b = format(i, "0" + str(N) + "b")
    for j in range(M):
        if sum([int(b[x-1]) for x in s[j]]) % 2 != p[j]:
            break
        if j == M - 1:
            ans += 1

print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M k = [0] * M k [0] * M [0] 0 M s = [0] * M s [0] * M [0] 0 M for i in range(M):
    s[i] = list(map(int, input().split()))
    k[i] = s[i].pop(0) i range(M) range M s[i] = list(map(int, input().split())) s[i] s i list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k[i] = s[i].pop(0) k[i] k i s[i].pop(0) [i].pop [i] s i pop 0 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):
    b = format(i, "0" + str(N) + "b")
    for j in range(M):
        if sum([int(b[x-1]) for x in s[j]]) % 2 != p[j]:
            break
        if j == M - 1:
            ans += 1 i range(2**N) range 2**N 2 N b = format(i, "0" + str(N) + "b") b format(i, "0" + str(N) + "b") format i "0" + str(N) + "b" "0" + str(N) "0" str(N) str N "b" for j in range(M):
        if sum([int(b[x-1]) for x in s[j]]) % 2 != p[j]:
            break
        if j == M - 1:
            ans += 1 j range(M) range M if sum([int(b[x-1]) for x in s[j]]) % 2 != p[j]:
            break
         sum([int(b[x-1]) for x in s[j]]) % 2 != p[j] sum([int(b[x-1]) for x in s[j]]) % 2 sum([int(b[x-1]) for x in s[j]]) sum [int(b[x-1]) for x in s[j]] 2 p[j] p j break if j == M - 1:
            ans += 1 j == M - 1 j M - 1 M 1 ans += 1 ans 1 print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N p = list(map(int, input().split())) list(map(int, input().split())) p s = [0] * M [0] * M s M = map(int, input().split()) map(int, input().split()) M k = [0] * M [0] * M k ans = 0 0 ans b = format(i, "0" + str(N) + "b") format(i, "0" + str(N) + "b") b ans += 1 1 ans
N, M = map(int, input().split())
k = [0] * M
s = [0] * M
for i in range(M):
    s[i] = list(map(int, input().split()))
    k[i] = s[i].pop(0)
p = list(map(int, input().split()))

ans = 0

for i in range(2**N):
    b = format(i, "0" + str(N) + "b")
    for j in range(M):
        if sum([int(b[x-1]) for x in s[j]]) % 2 != p[j]:
            break
        if j == M - 1:
            ans += 1

print(ans)