n,m = map(int, input().split())
K = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
    bit = [i>>j&1 for j in range(n)]
    for j,k in enumerate(K):
        if p[j] != sum([bit[l-1] for l in k])%2:
            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()))[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 K = [list(map(int, input().split()))[1:] for _ in range(m)] K [list(map(int, input().split()))[1:] 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(2**n):
    bit = [i>>j&1 for j in range(n)]
    for j,k in enumerate(K):
        if p[j] != sum([bit[l-1] for l in k])%2:
            break
    else:
        ans += 1 i range(2**n) range 2**n 2 n i>>j&1 for j in range(n) for j in range(n) j range(n) range n for j in range(n) i>>j&1 i>>j i j 1 bit = [i>>j&1 for j in range(n)] bit [i>>j&1 for j in range(n)] for j,k in enumerate(K):
        if p[j] != sum([bit[l-1] for l in k])%2:
            break
    else:
        ans += 1 j k enumerate(K) enumerate K if p[j] != sum([bit[l-1] for l in k])%2:
            break
     p[j] != sum([bit[l-1] for l in k])%2 p[j] p j sum([bit[l-1] for l in k])%2 sum([bit[l-1] for l in k]) sum [bit[l-1] for l in k] 2 break ans += 1 ans 1 print(ans) print ans n,m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m K = [list(map(int, input().split()))[1:] for _ in range(m)] [list(map(int, input().split()))[1:] for _ in range(m)] K ans = 0 0 ans bit = [i>>j&1 for j in range(n)] [i>>j&1 for j in range(n)] bit p = list(map(int, input().split())) list(map(int, input().split())) p ans += 1 1 ans
n,m = map(int, input().split())
K = [list(map(int, input().split()))[1:] for _ in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2**n):
    bit = [i>>j&1 for j in range(n)]
    for j,k in enumerate(K):
        if p[j] != sum([bit[l-1] for l in k])%2:
            break
    else:
        ans += 1
print(ans)
