N, M = list(map(int, input().split()))
ks = [list(map(int, input().split())) for _ in range(M)]
p = list(map(int, input().split()))

ans = 0
for i in range(1 << N):
  for j in range(M):
    t = 0
    for k in range(1, ks[j][0] + 1):
      if i >> (ks[j][k] - 1) & 1:
        t += 1
    if t % 2 != p[j]:
      break
  else:
    ans += 1

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

ans = 0
for i in range(1 << N):
  for j in range(M):
    t = 0
    for k in range(1, ks[j][0] + 1):
      if i >> (ks[j][k] - 1) & 1:
        t += 1
    if t % 2 != p[j]:
      break
  else:
    ans += 1

print(ans)
