N,M=map(int,input().split())
KS=[list(map(int,input().split())) for _ in range(M)]
p=list(map(int,input().split()))
ans=0
for i in range(1<<N):
  judge=1
  for j in range(M):
    cnt=0
    for k in KS[j][1:]:
      if i>>(k-1)&1:
        cnt+=1
    if (cnt%2)!=p[j]:
      judge=0
  if judge==1:
    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 _ in range(M) for _ in range(M) _ range(M) range M for _ 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 _ in range(M)] KS [list(map(int,input().split())) for _ 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(1<<N):
  judge=1
  for j in range(M):
    cnt=0
    for k in KS[j][1:]:
      if i>>(k-1)&1:
        cnt+=1
    if (cnt%2)!=p[j]:
      judge=0
  if judge==1:
    ans+=1 i range(1<<N) range 1<<N 1 N judge=1 judge 1 for j in range(M):
    cnt=0
    for k in KS[j][1:]:
      if i>>(k-1)&1:
        cnt+=1
    if (cnt%2)!=p[j]:
      judge=0
   j range(M) range M cnt=0 cnt 0 for k in KS[j][1:]:
      if i>>(k-1)&1:
        cnt+=1
     k KS[j][1:] [j] KS j 1: 1 if i>>(k-1)&1:
        cnt+=1
     i>>(k-1)&1 i>>(k-1) i k-1 k 1 1 cnt+=1 cnt 1 if (cnt%2)!=p[j]:
      judge=0
   (cnt%2)!=p[j] cnt%2 cnt 2 p[j] p j judge=0 judge 0 if judge==1:
    ans+=1 judge==1 judge 1 ans+=1 ans 1 print(ans) print ans judge=1 1 judge cnt=0 0 cnt M=map(int,input().split()) map(int,input().split()) M judge=0 0 judge KS=[list(map(int,input().split())) for _ in range(M)] [list(map(int,input().split())) for _ in range(M)] KS N,M=map(int,input().split()) map(int,input().split()) N p=list(map(int,input().split())) list(map(int,input().split())) p ans=0 0 ans cnt+=1 1 cnt ans+=1 1 ans
N,M=map(int,input().split())
KS=[list(map(int,input().split())) for _ in range(M)]
p=list(map(int,input().split()))
ans=0
for i in range(1<<N):
  judge=1
  for j in range(M):
    cnt=0
    for k in KS[j][1:]:
      if i>>(k-1)&1:
        cnt+=1
    if (cnt%2)!=p[j]:
      judge=0
  if judge==1:
    ans+=1
print(ans)