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