n, m = map(int, input().split())
ks = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2 ** n):
  onswichi = [False] * n
  onlight = [0] * m
  for j in range(n):
    if (i >> j) & 1:
      onswichi[j] = True
  for k in range(m):
    cnt = 0
    for f in ks[k][1:]:
      if onswichi[f-1]:
        cnt += 1
    if cnt % 2 == p[k]:
      onlight[k] = 1
  if sum(onlight) == m:
    ans += 1
print(ans) 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 i in range(m) for i in range(m) i range(m) range m for i 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 i in range(m)] ks [list(map(int, input().split())) for i 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(2 ** n):
  onswichi = [False] * n
  onlight = [0] * m
  for j in range(n):
    if (i >> j) & 1:
      onswichi[j] = True
  for k in range(m):
    cnt = 0
    for f in ks[k][1:]:
      if onswichi[f-1]:
        cnt += 1
    if cnt % 2 == p[k]:
      onlight[k] = 1
  if sum(onlight) == m:
    ans += 1 i range(2 ** n) range 2 ** n 2 n onswichi = [False] * n onswichi [False] * n [False] False n onlight = [0] * m onlight [0] * m [0] 0 m for j in range(n):
    if (i >> j) & 1:
      onswichi[j] = True
   j range(n) range n if (i >> j) & 1:
      onswichi[j] = True
   (i >> j) & 1 i >> j i j 1 onswichi[j] = True onswichi[j] onswichi j True for k in range(m):
    cnt = 0
    for f in ks[k][1:]:
      if onswichi[f-1]:
        cnt += 1
    if cnt % 2 == p[k]:
      onlight[k] = 1
   k range(m) range m cnt = 0 cnt 0 for f in ks[k][1:]:
      if onswichi[f-1]:
        cnt += 1
     f ks[k][1:] [k] ks k 1: 1 if onswichi[f-1]:
        cnt += 1
     onswichi[f-1] onswichi f-1 f 1 cnt += 1 cnt 1 if cnt % 2 == p[k]:
      onlight[k] = 1
   cnt % 2 == p[k] cnt % 2 cnt 2 p[k] p k onlight[k] = 1 onlight[k] onlight k 1 if sum(onlight) == m:
    ans += 1 sum(onlight) == m sum(onlight) sum onlight m ans += 1 ans 1 print(ans) print ans cnt += 1 1 cnt onswichi = [False] * n [False] * n onswichi onlight = [0] * m [0] * m onlight ks = [list(map(int, input().split())) for i in range(m)] [list(map(int, input().split())) for i in range(m)] ks p = list(map(int, input().split())) list(map(int, input().split())) p ans = 0 0 ans cnt = 0 0 cnt n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m ans += 1 1 ans
n, m = map(int, input().split())
ks = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
ans = 0
for i in range(2 ** n):
  onswichi = [False] * n
  onlight = [0] * m
  for j in range(n):
    if (i >> j) & 1:
      onswichi[j] = True
  for k in range(m):
    cnt = 0
    for f in ks[k][1:]:
      if onswichi[f-1]:
        cnt += 1
    if cnt % 2 == p[k]:
      onlight[k] = 1
  if sum(onlight) == m:
    ans += 1
print(ans)