n,m = map(int,input().split())
ans = 0
Lamp_switch = []
for _ in range(m):
    S = list(map(int, input().split()))[1:]
    Lamp_switch.append(S)
Pon = list(map(int, input().split()))

for i in range(2**n):
  cnt = [0]*m
  for j in range(n):
    if (i>>j)&1:
      for k in range(m):
        if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
  if cnt == Pon:
    ans += 1
    
print(ans) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m ans = 0 ans 0 Lamp_switch = [] Lamp_switch [] for _ in range(m):
    S = list(map(int, input().split()))[1:]
    Lamp_switch.append(S) _ range(m) range m S = list(map(int, input().split()))[1:] S list(map(int, input().split()))[1:] (map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 1: 1 Lamp_switch.append(S) Lamp_switch.append Lamp_switch append S Pon = list(map(int, input().split())) Pon list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for i in range(2**n):
  cnt = [0]*m
  for j in range(n):
    if (i>>j)&1:
      for k in range(m):
        if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
  if cnt == Pon:
    ans += 1
     i range(2**n) range 2**n 2 n cnt = [0]*m cnt [0]*m [0] 0 m for j in range(n):
    if (i>>j)&1:
      for k in range(m):
        if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
   j range(n) range n if (i>>j)&1:
      for k in range(m):
        if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
   (i>>j)&1 i>>j i j 1 for k in range(m):
        if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
   k range(m) range m if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
   (j+1) in Lamp_switch[k] j+1 j 1 Lamp_switch[k] Lamp_switch k cnt[k] += 1 cnt[k] cnt k 1 cnt[k] %= 2 cnt[k] cnt k 2 if cnt == Pon:
    ans += 1
     cnt == Pon cnt Pon ans += 1 ans 1 print(ans) print ans ans += 1 1 ans Lamp_switch = [] [] Lamp_switch n,m = map(int,input().split()) map(int,input().split()) n cnt = [0]*m [0]*m cnt Pon = list(map(int, input().split())) list(map(int, input().split())) Pon m = map(int,input().split()) map(int,input().split()) m S = list(map(int, input().split()))[1:] list(map(int, input().split()))[1:] S ans = 0 0 ans
n,m = map(int,input().split())
ans = 0
Lamp_switch = []
for _ in range(m):
    S = list(map(int, input().split()))[1:]
    Lamp_switch.append(S)
Pon = list(map(int, input().split()))

for i in range(2**n):
  cnt = [0]*m
  for j in range(n):
    if (i>>j)&1:
      for k in range(m):
        if (j+1) in Lamp_switch[k]:
          cnt[k] += 1
          cnt[k] %= 2
  if cnt == Pon:
    ans += 1
    
print(ans)