N, M = list(map(int, input().split()))
V = [list(map(lambda x: int(x) - 1, input().split()))[1:] for _ in range(M)]
P = list(map(int, input().split()))
res = 0
for i in range(1 << N):
    B = format(i, f'0{N}b')[::-1]
    flg = True
    for j in range(M):
        cnt = 0
        for s in V[j]:
            if B[s] == '1':
                cnt += 1
        if cnt % 2 != P[j]:
            flg = False
    res += int(flg)
print(res) N, M = list(map(int, input().split())) N list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split M list(map(lambda x: int(x) - 1, input().split()))[1:] for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) list(map(lambda x: int(x) - 1, input().split()))[1:] (map(lambda x: int(x) - 1, input().split())) list map(lambda x: int(x) - 1, input().split()) map lambda x: int(x) - 1 int(x) - 1 int(x) int x 1 x input().split() ().split () input split 1: 1 V = [list(map(lambda x: int(x) - 1, input().split()))[1:] for _ in range(M)] V [list(map(lambda x: int(x) - 1, 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 res = 0 res 0 for i in range(1 << N):
    B = format(i, f'0{N}b')[::-1]
    flg = True
    for j in range(M):
        cnt = 0
        for s in V[j]:
            if B[s] == '1':
                cnt += 1
        if cnt % 2 != P[j]:
            flg = False
    res += int(flg) i range(1 << N) range 1 << N 1 N B = format(i, f'0{N}b')[::-1] B format(i, f'0{N}b')[::-1] (i, f'0{N}b') format i f'0{N}b' ::-1 -1 flg = True flg True for j in range(M):
        cnt = 0
        for s in V[j]:
            if B[s] == '1':
                cnt += 1
        if cnt % 2 != P[j]:
            flg = False
     j range(M) range M cnt = 0 cnt 0 for s in V[j]:
            if B[s] == '1':
                cnt += 1
         s V[j] V j if B[s] == '1':
                cnt += 1
         B[s] == '1' B[s] B s '1' cnt += 1 cnt 1 if cnt % 2 != P[j]:
            flg = False
     cnt % 2 != P[j] cnt % 2 cnt 2 P[j] P j flg = False flg False res += int(flg) res int(flg) int flg print(res) print res flg = True True flg cnt = 0 0 cnt cnt += 1 1 cnt N, M = list(map(int, input().split())) list(map(int, input().split())) N V = [list(map(lambda x: int(x) - 1, input().split()))[1:] for _ in range(M)] [list(map(lambda x: int(x) - 1, input().split()))[1:] for _ in range(M)] V B = format(i, f'0{N}b')[::-1] format(i, f'0{N}b')[::-1] B M = list(map(int, input().split())) list(map(int, input().split())) M res = 0 0 res res += int(flg) int(flg) res flg = False False flg P = list(map(int, input().split())) list(map(int, input().split())) P
N, M = list(map(int, input().split()))
V = [list(map(lambda x: int(x) - 1, input().split()))[1:] for _ in range(M)]
P = list(map(int, input().split()))
res = 0
for i in range(1 << N):
    B = format(i, f'0{N}b')[::-1]
    flg = True
    for j in range(M):
        cnt = 0
        for s in V[j]:
            if B[s] == '1':
                cnt += 1
        if cnt % 2 != P[j]:
            flg = False
    res += int(flg)
print(res)
