N, M = map(int, input().split())
List = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
num = 0
for i in range(2**N): 
  B = [0 for _ in range(M)] 
  for j in range(N):
    if ((i>>j)&1):
      for k in range(M):
        if j+1 in List[k][1:]:
          B[k] += 1
  for l in range(M):
    if B[l] % 2 != p[l]:
      break
  else:
    num += 1
print(num) 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 List = [list(map(int, input().split())) for _ in range(M)] List [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 num = 0 num 0 for i in range(2**N): 
  B = [0 for _ in range(M)] 
  for j in range(N):
    if ((i>>j)&1):
      for k in range(M):
        if j+1 in List[k][1:]:
          B[k] += 1
  for l in range(M):
    if B[l] % 2 != p[l]:
      break
  else:
    num += 1 i range(2**N) range 2**N 2 N 0 for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) 0 B = [0 for _ in range(M)] B [0 for _ in range(M)] for j in range(N):
    if ((i>>j)&1):
      for k in range(M):
        if j+1 in List[k][1:]:
          B[k] += 1
   j range(N) range N if ((i>>j)&1):
      for k in range(M):
        if j+1 in List[k][1:]:
          B[k] += 1
   (i>>j)&1 i>>j i j 1 for k in range(M):
        if j+1 in List[k][1:]:
          B[k] += 1
   k range(M) range M if j+1 in List[k][1:]:
          B[k] += 1
   j+1 in List[k][1:] j+1 j 1 List[k][1:] [k] List k 1: 1 B[k] += 1 B[k] B k 1 for l in range(M):
    if B[l] % 2 != p[l]:
      break
  else:
    num += 1 l range(M) range M if B[l] % 2 != p[l]:
      break
   B[l] % 2 != p[l] B[l] % 2 B[l] B l 2 p[l] p l break num += 1 num 1 print(num) print num num = 0 0 num List = [list(map(int, input().split())) for _ in range(M)] [list(map(int, input().split())) for _ in range(M)] List M = map(int, input().split()) map(int, input().split()) M num += 1 1 num B = [0 for _ in range(M)] [0 for _ in range(M)] B N, M = map(int, input().split()) map(int, input().split()) N p = list(map(int, input().split())) list(map(int, input().split())) p
N, M = map(int, input().split())
List = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))
num = 0
for i in range(2**N): 
  B = [0 for _ in range(M)] 
  for j in range(N):
    if ((i>>j)&1):
      for k in range(M):
        if j+1 in List[k][1:]:
          B[k] += 1
  for l in range(M):
    if B[l] % 2 != p[l]:
      break
  else:
    num += 1
print(num)