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