n,m=map(int,input().split())
num=[]
for i in range(m):
    num.append(list(map(int,input().split())))
num3=[[] for _ in range(n)]
for i in range(m):
    for j in range(1,num[i][0]+1):
        num3[num[i][j]-1].append(i+1)
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    num2=[0]*m
    num4=0
    for j in range(n):
        if (i>>j) & 1:
            for k in range(len(num3[j])):
                num2[num3[j][k]-1]+=1
    for j in range(m):
        if num2[j]%2!=p[j]:
            num4=1
            break
    if num4==0:
        ans+=1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m num=[] num [] for i in range(m):
    num.append(list(map(int,input().split()))) i range(m) range m num.append(list(map(int,input().split()))) num.append num append list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split [] for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) [] num3=[[] for _ in range(n)] num3 [[] for _ in range(n)] for i in range(m):
    for j in range(1,num[i][0]+1):
        num3[num[i][j]-1].append(i+1) i range(m) range m for j in range(1,num[i][0]+1):
        num3[num[i][j]-1].append(i+1) j range(1,num[i][0]+1) range 1 num[i][0]+1 num[i][0] [i] num i 0 1 num3[num[i][j]-1].append(i+1) [num[i][j]-1].append [num[i][j]-1] num3 num[i][j]-1 num[i][j] [i] num i j 1 append i+1 i 1 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(2**n):
    num2=[0]*m
    num4=0
    for j in range(n):
        if (i>>j) & 1:
            for k in range(len(num3[j])):
                num2[num3[j][k]-1]+=1
    for j in range(m):
        if num2[j]%2!=p[j]:
            num4=1
            break
    if num4==0:
        ans+=1 i range(2**n) range 2**n 2 n num2=[0]*m num2 [0]*m [0] 0 m num4=0 num4 0 for j in range(n):
        if (i>>j) & 1:
            for k in range(len(num3[j])):
                num2[num3[j][k]-1]+=1
     j range(n) range n if (i>>j) & 1:
            for k in range(len(num3[j])):
                num2[num3[j][k]-1]+=1
     (i>>j) & 1 i>>j i j 1 for k in range(len(num3[j])):
                num2[num3[j][k]-1]+=1
     k range(len(num3[j])) range len(num3[j]) len num3[j] num3 j num2[num3[j][k]-1]+=1 num2[num3[j][k]-1] num2 num3[j][k]-1 num3[j][k] [j] num3 j k 1 1 for j in range(m):
        if num2[j]%2!=p[j]:
            num4=1
            break
     j range(m) range m if num2[j]%2!=p[j]:
            num4=1
            break
     num2[j]%2!=p[j] num2[j]%2 num2[j] num2 j 2 p[j] p j num4=1 num4 1 break if num4==0:
        ans+=1 num4==0 num4 0 ans+=1 ans 1 print(ans) print ans ans=0 0 ans n,m=map(int,input().split()) map(int,input().split()) n num3=[[] for _ in range(n)] [[] for _ in range(n)] num3 num2=[0]*m [0]*m num2 ans+=1 1 ans num4=0 0 num4 p=list(map(int,input().split())) list(map(int,input().split())) p m=map(int,input().split()) map(int,input().split()) m num=[] [] num num4=1 1 num4
n,m=map(int,input().split())
num=[]
for i in range(m):
    num.append(list(map(int,input().split())))
num3=[[] for _ in range(n)]
for i in range(m):
    for j in range(1,num[i][0]+1):
        num3[num[i][j]-1].append(i+1)
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    num2=[0]*m
    num4=0
    for j in range(n):
        if (i>>j) & 1:
            for k in range(len(num3[j])):
                num2[num3[j][k]-1]+=1
    for j in range(m):
        if num2[j]%2!=p[j]:
            num4=1
            break
    if num4==0:
        ans+=1
print(ans)
