n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
count = 0
for i in range(2 ** n):
    on_number = [0] * m
    for j in range(n):
        if i >> j & 1:
            for k in range(m):
                if (j + 1) in s[k][1:]:
                    on_number[k] += 1
    flag = 0
    for k in range(m):
        if on_number[k] % 2 == p[k]:
            flag += 1
        if flag == m:
            count += 1
print(count) 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 s = [list(map(int, input().split())) for _ in range(m)] s [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 count = 0 count 0 for i in range(2 ** n):
    on_number = [0] * m
    for j in range(n):
        if i >> j & 1:
            for k in range(m):
                if (j + 1) in s[k][1:]:
                    on_number[k] += 1
    flag = 0
    for k in range(m):
        if on_number[k] % 2 == p[k]:
            flag += 1
        if flag == m:
            count += 1 i range(2 ** n) range 2 ** n 2 n on_number = [0] * m on_number [0] * m [0] 0 m for j in range(n):
        if i >> j & 1:
            for k in range(m):
                if (j + 1) in s[k][1:]:
                    on_number[k] += 1
     j range(n) range n if i >> j & 1:
            for k in range(m):
                if (j + 1) in s[k][1:]:
                    on_number[k] += 1
     i >> j & 1 i >> j i j 1 for k in range(m):
                if (j + 1) in s[k][1:]:
                    on_number[k] += 1
     k range(m) range m if (j + 1) in s[k][1:]:
                    on_number[k] += 1
     (j + 1) in s[k][1:] j + 1 j 1 s[k][1:] [k] s k 1: 1 on_number[k] += 1 on_number[k] on_number k 1 flag = 0 flag 0 for k in range(m):
        if on_number[k] % 2 == p[k]:
            flag += 1
        if flag == m:
            count += 1 k range(m) range m if on_number[k] % 2 == p[k]:
            flag += 1
         on_number[k] % 2 == p[k] on_number[k] % 2 on_number[k] on_number k 2 p[k] p k flag += 1 flag 1 if flag == m:
            count += 1 flag == m flag m count += 1 count 1 print(count) print count count = 0 0 count count += 1 1 count flag += 1 1 flag s = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] s n, m = map(int, input().split()) map(int, input().split()) n on_number = [0] * m [0] * m on_number m = map(int, input().split()) map(int, input().split()) m p = list(map(int, input().split())) list(map(int, input().split())) p flag = 0 0 flag
n, m = map(int, input().split())
s = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))
count = 0
for i in range(2 ** n):
    on_number = [0] * m
    for j in range(n):
        if i >> j & 1:
            for k in range(m):
                if (j + 1) in s[k][1:]:
                    on_number[k] += 1
    flag = 0
    for k in range(m):
        if on_number[k] % 2 == p[k]:
            flag += 1
        if flag == m:
            count += 1
print(count)