n, m = map(int, input().split())
klst = []
for i in range(m):
  klst.append(list(map(lambda x: int(x) - 1, input().split()))[1:])
plst = list(map(int, input().split()))
res = 0
for ibit in range(2 ** n):
  TF = True
  for j in range(m):
    cnt = 0
    for swnum in klst[j]:
      if ((ibit >> swnum) & 1):
        cnt += 1
    if cnt % 2 != plst[j]:
      TF = False
  if TF:
    res += 1
print(res) n, m = map(int, input().split()) n map(int, input().split()) map int input().split() ().split () input split m klst = [] klst [] for i in range(m):
  klst.append(list(map(lambda x: int(x) - 1, input().split()))[1:]) i range(m) range m klst.append(list(map(lambda x: int(x) - 1, input().split()))[1:]) klst.append klst append list(map(lambda x: int(x) - 1, input().split()))[1:] (map(lambda x: int(x) - 1, input().split())) list map(lambda x: int(x) - 1, input().split()) map lambda x: int(x) - 1 int(x) - 1 int(x) int x 1 x input().split() ().split () input split 1: 1 plst = list(map(int, input().split())) plst list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split res = 0 res 0 for ibit in range(2 ** n):
  TF = True
  for j in range(m):
    cnt = 0
    for swnum in klst[j]:
      if ((ibit >> swnum) & 1):
        cnt += 1
    if cnt % 2 != plst[j]:
      TF = False
  if TF:
    res += 1 ibit range(2 ** n) range 2 ** n 2 n TF = True TF True for j in range(m):
    cnt = 0
    for swnum in klst[j]:
      if ((ibit >> swnum) & 1):
        cnt += 1
    if cnt % 2 != plst[j]:
      TF = False
   j range(m) range m cnt = 0 cnt 0 for swnum in klst[j]:
      if ((ibit >> swnum) & 1):
        cnt += 1
     swnum klst[j] klst j if ((ibit >> swnum) & 1):
        cnt += 1
     (ibit >> swnum) & 1 ibit >> swnum ibit swnum 1 cnt += 1 cnt 1 if cnt % 2 != plst[j]:
      TF = False
   cnt % 2 != plst[j] cnt % 2 cnt 2 plst[j] plst j TF = False TF False if TF:
    res += 1 TF res += 1 res 1 print(res) print res n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m cnt += 1 1 cnt TF = False False TF plst = list(map(int, input().split())) list(map(int, input().split())) plst res = 0 0 res TF = True True TF cnt = 0 0 cnt klst = [] [] klst res += 1 1 res
n, m = map(int, input().split())
klst = []
for i in range(m):
  klst.append(list(map(lambda x: int(x) - 1, input().split()))[1:])
plst = list(map(int, input().split()))
res = 0
for ibit in range(2 ** n):
  TF = True
  for j in range(m):
    cnt = 0
    for swnum in klst[j]:
      if ((ibit >> swnum) & 1):
        cnt += 1
    if cnt % 2 != plst[j]:
      TF = False
  if TF:
    res += 1
print(res)