N, M = map(int, input().split())
S = [tuple(map(int, input().split()))[1:] for _ in range(M)]
P = tuple(map(int, input().split()))

ans = 0
for state in range(2 ** N):
  for m in range(M):
    count = 0
    for s in S[m]:
      if state & (1 << (s - 1)):
        count += 1
    if count % 2 != P[m]:
      break
  else:
    ans += 1
print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M tuple(map(int, input().split()))[1:] for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) tuple(map(int, input().split()))[1:] (map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split 1: 1 S = [tuple(map(int, input().split()))[1:] for _ in range(M)] S [tuple(map(int, input().split()))[1:] for _ in range(M)] P = tuple(map(int, input().split())) P tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for state in range(2 ** N):
  for m in range(M):
    count = 0
    for s in S[m]:
      if state & (1 << (s - 1)):
        count += 1
    if count % 2 != P[m]:
      break
  else:
    ans += 1 state range(2 ** N) range 2 ** N 2 N for m in range(M):
    count = 0
    for s in S[m]:
      if state & (1 << (s - 1)):
        count += 1
    if count % 2 != P[m]:
      break
  else:
    ans += 1 m range(M) range M count = 0 count 0 for s in S[m]:
      if state & (1 << (s - 1)):
        count += 1
     s S[m] S m if state & (1 << (s - 1)):
        count += 1
     state & (1 << (s - 1)) state 1 << (s - 1) 1 s - 1 s 1 count += 1 count 1 if count % 2 != P[m]:
      break
   count % 2 != P[m] count % 2 count 2 P[m] P m break ans += 1 ans 1 print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N ans += 1 1 ans M = map(int, input().split()) map(int, input().split()) M ans = 0 0 ans count = 0 0 count count += 1 1 count S = [tuple(map(int, input().split()))[1:] for _ in range(M)] [tuple(map(int, input().split()))[1:] for _ in range(M)] S P = tuple(map(int, input().split())) tuple(map(int, input().split())) P
N, M = map(int, input().split())
S = [tuple(map(int, input().split()))[1:] for _ in range(M)]
P = tuple(map(int, input().split()))

ans = 0
for state in range(2 ** N):
  for m in range(M):
    count = 0
    for s in S[m]:
      if state & (1 << (s - 1)):
        count += 1
    if count % 2 != P[m]:
      break
  else:
    ans += 1
print(ans)