N, M = map(int, input().split())
s = [list(map(int, input().split()))[1:] for i in range(M)]
p = list(map(int, input().split()))
cnt = 0
for a in range(2 ** N):
    flag = 1
    for i in range(M):
        if sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 != p[i]:
            flag = 0
            break
    cnt += flag
print(cnt) 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 i in range(M) for i in range(M) i range(M) range M for i 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 s = [list(map(int, input().split()))[1:] for i in range(M)] s [list(map(int, input().split()))[1:] for i 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 cnt = 0 cnt 0 for a in range(2 ** N):
    flag = 1
    for i in range(M):
        if sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 != p[i]:
            flag = 0
            break
    cnt += flag a range(2 ** N) range 2 ** N 2 N flag = 1 flag 1 for i in range(M):
        if sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 != p[i]:
            flag = 0
            break
     i range(M) range M if sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 != p[i]:
            flag = 0
            break
     sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 != p[i] sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 sum([(a >> (x - 1)) & 1 for x in s[i]]) sum [(a >> (x - 1)) & 1 for x in s[i]] 2 p[i] p i flag = 0 flag 0 break cnt += flag cnt flag print(cnt) print cnt flag = 0 0 flag N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M s = [list(map(int, input().split()))[1:] for i in range(M)] [list(map(int, input().split()))[1:] for i in range(M)] s p = list(map(int, input().split())) list(map(int, input().split())) p cnt = 0 0 cnt flag = 1 1 flag cnt += flag flag cnt
N, M = map(int, input().split())
s = [list(map(int, input().split()))[1:] for i in range(M)]
p = list(map(int, input().split()))
cnt = 0
for a in range(2 ** N):
    flag = 1
    for i in range(M):
        if sum([(a >> (x - 1)) & 1 for x in s[i]]) % 2 != p[i]:
            flag = 0
            break
    cnt += flag
print(cnt)