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

ans=0
for i in range(1<<N):
  sw=[False]*M
  for j in range(M):
    cnt=0
    for k in range(1,len(S[j])):
      if (i>>(S[j][k]-1))&1:
        cnt+=1
      else:
        flag=0
    if cnt%2==P[j]:
      sw[j]=True
  if all(sw):
    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 S=[list(map(int,input().split())) for _ in range(M)] S [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):
  sw=[False]*M
  for j in range(M):
    cnt=0
    for k in range(1,len(S[j])):
      if (i>>(S[j][k]-1))&1:
        cnt+=1
      else:
        flag=0
    if cnt%2==P[j]:
      sw[j]=True
  if all(sw):
    ans+=1 i range(1<<N) range 1<<N 1 N sw=[False]*M sw [False]*M [False] False M for j in range(M):
    cnt=0
    for k in range(1,len(S[j])):
      if (i>>(S[j][k]-1))&1:
        cnt+=1
      else:
        flag=0
    if cnt%2==P[j]:
      sw[j]=True
   j range(M) range M cnt=0 cnt 0 for k in range(1,len(S[j])):
      if (i>>(S[j][k]-1))&1:
        cnt+=1
      else:
        flag=0
     k range(1,len(S[j])) range 1 len(S[j]) len S[j] S j if (i>>(S[j][k]-1))&1:
        cnt+=1
      else:
        flag=0
     (i>>(S[j][k]-1))&1 i>>(S[j][k]-1) i S[j][k]-1 S[j][k] [j] S j k 1 1 cnt+=1 cnt 1 flag=0 flag 0 if cnt%2==P[j]:
      sw[j]=True
   cnt%2==P[j] cnt%2 cnt 2 P[j] P j sw[j]=True sw[j] sw j True if all(sw):
    ans+=1 all(sw) all sw ans+=1 ans 1 print(ans) print ans S=[list(map(int,input().split())) for _ in range(M)] [list(map(int,input().split())) for _ in range(M)] S ans+=1 1 ans M=map(int,input().split()) map(int,input().split()) M cnt=0 0 cnt ans=0 0 ans sw=[False]*M [False]*M sw cnt+=1 1 cnt N,M=map(int,input().split()) map(int,input().split()) N P=list(map(int,input().split())) list(map(int,input().split())) P flag=0 0 flag
N,M=map(int,input().split())
S=[list(map(int,input().split())) for _ in range(M)]
P=list(map(int,input().split()))

ans=0
for i in range(1<<N):
  sw=[False]*M
  for j in range(M):
    cnt=0
    for k in range(1,len(S[j])):
      if (i>>(S[j][k]-1))&1:
        cnt+=1
      else:
        flag=0
    if cnt%2==P[j]:
      sw[j]=True
  if all(sw):
    ans+=1
print(ans)