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

print(ans)