N,M=map(int,input().split())
k=[list(map(int,input().split())) for _ in range(M)] 
*p,=map(int,input().split())
t=0
a=0
for i in range(2 ** N):
 t=sum(1 for j in range(M) if sum(1 for h in k[j][1:] if i>>(h-1)&1)%2==p[j])
 if t==M:a+=1
print(a) 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 k=[list(map(int,input().split())) for _ in range(M)] k [list(map(int,input().split())) for _ in range(M)] *p,=map(int,input().split()) *p p map(int,input().split()) map int input().split() ().split () input split t=0 t 0 a=0 a 0 for i in range(2 ** N):
 t=sum(1 for j in range(M) if sum(1 for h in k[j][1:] if i>>(h-1)&1)%2==p[j])
 if t==M:a+=1 i range(2 ** N) range 2 ** N 2 N t=sum(1 for j in range(M) if sum(1 for h in k[j][1:] if i>>(h-1)&1)%2==p[j]) t sum(1 for j in range(M) if sum(1 for h in k[j][1:] if i>>(h-1)&1)%2==p[j]) sum 1 if t==M:a+= t==M t M print(a) print a a=0 0 a t=sum(1 for j in range(M) if sum(1 for h in k[j][1:] if i>>(h-1)&1)%2==p[j]) sum(1 for j in range(M) if sum(1 for h in k[j][1:] if i>>(h-1)&1)%2==p[j]) t k=[list(map(int,input().split())) for _ in range(M)] [list(map(int,input().split())) for _ in range(M)] k M=map(int,input().split()) map(int,input().split()) M N,M=map(int,input().split()) map(int,input().split()) N t=0 0 t
N,M=map(int,input().split())
k=[list(map(int,input().split())) for _ in range(M)] 
*p,=map(int,input().split())
t=0
a=0
for i in range(2 ** N):
 t=sum(1 for j in range(M) if sum(1 for h in k[j][1:] if i>>(h-1)&1)%2==p[j])
 if t==M:a+=1
print(a)