import numpy as np
 
N, M = map(int, input().split())
array = np.zeros([M, N])
for i in range(M):
    l = list(map(int, input().split()))
    for j in l[1:]:
        array[i, j-1] = 1
p = np.array(list(map(int, input().split())))
count = 0
for i in range(1<<N):
    array_i = array.copy()
    for j in range(N):
        if i&(1<<j):
            array_i[:, j-1] = 0
    if sum(array_i.sum(1)%2 == p)==M:
        count += 1
print(count) import numpy as np numpy N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M array = np.zeros([M, N]) array np.zeros([M, N]) np.zeros np zeros [M, N] M N for i in range(M):
    l = list(map(int, input().split()))
    for j in l[1:]:
        array[i, j-1] = 1 i range(M) range M l = list(map(int, input().split())) l list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j in l[1:]:
        array[i, j-1] = 1 j l[1:] l 1: 1 array[i, j-1] = 1 array[i, j-1] array i 1 p = np.array(list(map(int, input().split()))) p np.array(list(map(int, input().split()))) np.array np array 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(1<<N):
    array_i = array.copy()
    for j in range(N):
        if i&(1<<j):
            array_i[:, j-1] = 0
    if sum(array_i.sum(1)%2 == p)==M:
        count += 1 i range(1<<N) range 1<<N 1 N array_i = array.copy() array_i array.copy() array.copy array copy for j in range(N):
        if i&(1<<j):
            array_i[:, j-1] = 0
     j range(N) range N if i&(1<<j):
            array_i[:, j-1] = 0
     i&(1<<j) i 1<<j 1 j array_i[:, j-1] = 0 array_i[:, j-1] array_i : 0 if sum(array_i.sum(1)%2 == p)==M:
        count += 1 sum(array_i.sum(1)%2 == p)==M sum(array_i.sum(1)%2 == p) sum array_i.sum(1)%2 == p array_i.sum(1)%2 array_i.sum(1) array_i.sum array_i sum 1 2 p M count += 1 count 1 print(count) print count array = np.zeros([M, N]) np.zeros([M, N]) array count = 0 0 count l = list(map(int, input().split())) list(map(int, input().split())) l p = np.array(list(map(int, input().split()))) np.array(list(map(int, input().split()))) p count += 1 1 count M = map(int, input().split()) map(int, input().split()) M array_i = array.copy() array.copy() array_i N, M = map(int, input().split()) map(int, input().split()) N
import numpy as np
 
N, M = map(int, input().split())
array = np.zeros([M, N])
for i in range(M):
    l = list(map(int, input().split()))
    for j in l[1:]:
        array[i, j-1] = 1
p = np.array(list(map(int, input().split())))
count = 0
for i in range(1<<N):
    array_i = array.copy()
    for j in range(N):
        if i&(1<<j):
            array_i[:, j-1] = 0
    if sum(array_i.sum(1)%2 == p)==M:
        count += 1
print(count)