N,M = map(int,input().split())
K = [0 for m in range(M)]
count = 0

for m in range(M):
  K[m] = list(map(int,input().split()))
P = list(map(int,input().split()))

for i in range(2**N):
  op = [0]*N
  for j in range(N):
    if ((i>>j) & 1):
      op[N-1-j] = 1
      
  flag = True
  
  for k in range(M):
    S = 0
    for l in range(K[k][0]):
      S += op[K[k][l+1]-1]
    if S % 2 != P[k]:
      flag = False
  if flag:
    count += 1
    
print(count) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M 0 for m in range(M) for m in range(M) m range(M) range M for m in range(M) 0 K = [0 for m in range(M)] K [0 for m in range(M)] count = 0 count 0 for m in range(M):
  K[m] = list(map(int,input().split())) m range(M) range M K[m] = list(map(int,input().split())) K[m] K m list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split P = list(map(int,input().split())) P list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(2**N):
  op = [0]*N
  for j in range(N):
    if ((i>>j) & 1):
      op[N-1-j] = 1
      
  flag = True
  
  for k in range(M):
    S = 0
    for l in range(K[k][0]):
      S += op[K[k][l+1]-1]
    if S % 2 != P[k]:
      flag = False
  if flag:
    count += 1
     i range(2**N) range 2**N 2 N op = [0]*N op [0]*N [0] 0 N for j in range(N):
    if ((i>>j) & 1):
      op[N-1-j] = 1
      
   j range(N) range N if ((i>>j) & 1):
      op[N-1-j] = 1
      
   (i>>j) & 1 i>>j i j 1 op[N-1-j] = 1 op[N-1-j] op N-1-j N-1 N 1 j 1 flag = True flag True for k in range(M):
    S = 0
    for l in range(K[k][0]):
      S += op[K[k][l+1]-1]
    if S % 2 != P[k]:
      flag = False
   k range(M) range M S = 0 S 0 for l in range(K[k][0]):
      S += op[K[k][l+1]-1]
     l range(K[k][0]) range K[k][0] [k] K k 0 S += op[K[k][l+1]-1] S op[K[k][l+1]-1] op K[k][l+1]-1 K[k][l+1] [k] K k l+1 l 1 1 if S % 2 != P[k]:
      flag = False
   S % 2 != P[k] S % 2 S 2 P[k] P k flag = False flag False if flag:
    count += 1
     flag count += 1 count 1 print(count) print count op = [0]*N [0]*N op N,M = map(int,input().split()) map(int,input().split()) N flag = False False flag K = [0 for m in range(M)] [0 for m in range(M)] K P = list(map(int,input().split())) list(map(int,input().split())) P count += 1 1 count flag = True True flag S += op[K[k][l+1]-1] op[K[k][l+1]-1] S count = 0 0 count S = 0 0 S M = map(int,input().split()) map(int,input().split()) M
N,M = map(int,input().split())
K = [0 for m in range(M)]
count = 0

for m in range(M):
  K[m] = list(map(int,input().split()))
P = list(map(int,input().split()))

for i in range(2**N):
  op = [0]*N
  for j in range(N):
    if ((i>>j) & 1):
      op[N-1-j] = 1
      
  flag = True
  
  for k in range(M):
    S = 0
    for l in range(K[k][0]):
      S += op[K[k][l+1]-1]
    if S % 2 != P[k]:
      flag = False
  if flag:
    count += 1
    
print(count)