N,M=map(int,input().split())
combiList = []
for i in range (M):
  combiList.append(list(map(int, input().split())))
kakuninList = list(map(int, input().split()))
statusList = [0]*M

for j in range (M):
  combiList[j].pop(0)
res = 0
# 010 なら2番目のみ派閥 
for bits in range(2**N): #k番目のグループ
  flag = True
  statusList = [0]*M
  for j in range(N):
    if((bits>>j) & 1): 
      for k in range(M):
        if j+1 in combiList[k]:
          statusList[k] +=1
  for k in range(M):
    if statusList[k] % 2 != kakuninList[k]:
      flag = False
      break
  if flag:
    res +=1
print(res) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M combiList = [] combiList [] for i in range (M):
  combiList.append(list(map(int, input().split()))) i range (M) range M combiList.append(list(map(int, input().split()))) combiList.append combiList append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split kakuninList = list(map(int, input().split())) kakuninList list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split statusList = [0]*M statusList [0]*M [0] 0 M for j in range (M):
  combiList[j].pop(0) j range (M) range M combiList[j].pop(0) [j].pop [j] combiList j pop 0 res = 0 res 0 for bits in range(2**N): #k番目のグループ
  flag = True
  statusList = [0]*M
  for j in range(N):
    if((bits>>j) & 1): 
      for k in range(M):
        if j+1 in combiList[k]:
          statusList[k] +=1
  for k in range(M):
    if statusList[k] % 2 != kakuninList[k]:
      flag = False
      break
  if flag:
    res +=1 bits range(2**N) range 2**N 2 N flag = True flag True statusList = [0]*M statusList [0]*M [0] 0 M for j in range(N):
    if((bits>>j) & 1): 
      for k in range(M):
        if j+1 in combiList[k]:
          statusList[k] +=1
   j range(N) range N if((bits>>j) & 1): 
      for k in range(M):
        if j+1 in combiList[k]:
          statusList[k] +=1
   (bits>>j) & 1 bits>>j bits j 1 for k in range(M):
        if j+1 in combiList[k]:
          statusList[k] +=1
   k range(M) range M if j+1 in combiList[k]:
          statusList[k] +=1
   j+1 in combiList[k] j+1 j 1 combiList[k] combiList k statusList[k] +=1 statusList[k] statusList k 1 for k in range(M):
    if statusList[k] % 2 != kakuninList[k]:
      flag = False
      break
   k range(M) range M if statusList[k] % 2 != kakuninList[k]:
      flag = False
      break
   statusList[k] % 2 != kakuninList[k] statusList[k] % 2 statusList[k] statusList k 2 kakuninList[k] kakuninList k flag = False flag False break if flag:
    res +=1 flag res +=1 res 1 print(res) print res statusList = [0]*M [0]*M statusList flag = False False flag statusList = [0]*M [0]*M statusList res +=1 1 res kakuninList = list(map(int, input().split())) list(map(int, input().split())) kakuninList N,M=map(int,input().split()) map(int,input().split()) N M=map(int,input().split()) map(int,input().split()) M combiList = [] [] combiList res = 0 0 res flag = True True flag
N,M=map(int,input().split())
combiList = []
for i in range (M):
  combiList.append(list(map(int, input().split())))
kakuninList = list(map(int, input().split()))
statusList = [0]*M

for j in range (M):
  combiList[j].pop(0)
res = 0
# 010 なら2番目のみ派閥 
for bits in range(2**N): #k番目のグループ
  flag = True
  statusList = [0]*M
  for j in range(N):
    if((bits>>j) & 1): 
      for k in range(M):
        if j+1 in combiList[k]:
          statusList[k] +=1
  for k in range(M):
    if statusList[k] % 2 != kakuninList[k]:
      flag = False
      break
  if flag:
    res +=1
print(res)