N,M=map(int,input().split())
L=[list(map(int,input().split())) for i in range(M)]
P=list(map(int,input().split()))
c=0
for i in range(2**N):
    A=[0]*N
    for j in range(N):
        if (i>>j&1):
            A[j]=1
    T=True
    for j in range(M):
        s=0
        for k in range(L[j][0]):
            s+=A[L[j][k+1]-1]
        if s%2!=P[j]:
            T=False
    if T:
        c+=1
print(c) 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 i in range(M) for i in range(M) i range(M) range M for i in range(M) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split L=[list(map(int,input().split())) for i in range(M)] L [list(map(int,input().split())) for i 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 c=0 c 0 for i in range(2**N):
    A=[0]*N
    for j in range(N):
        if (i>>j&1):
            A[j]=1
    T=True
    for j in range(M):
        s=0
        for k in range(L[j][0]):
            s+=A[L[j][k+1]-1]
        if s%2!=P[j]:
            T=False
    if T:
        c+=1 i range(2**N) range 2**N 2 N A=[0]*N A [0]*N [0] 0 N for j in range(N):
        if (i>>j&1):
            A[j]=1
     j range(N) range N if (i>>j&1):
            A[j]=1
     i>>j&1 i>>j i j 1 A[j]=1 A[j] A j 1 T=True T True for j in range(M):
        s=0
        for k in range(L[j][0]):
            s+=A[L[j][k+1]-1]
        if s%2!=P[j]:
            T=False
     j range(M) range M s=0 s 0 for k in range(L[j][0]):
            s+=A[L[j][k+1]-1]
         k range(L[j][0]) range L[j][0] [j] L j 0 s+=A[L[j][k+1]-1] s A[L[j][k+1]-1] A L[j][k+1]-1 L[j][k+1] [j] L j k+1 k 1 1 if s%2!=P[j]:
            T=False
     s%2!=P[j] s%2 s 2 P[j] P j T=False T False if T:
        c+=1 T c+=1 c 1 print(c) print c c=0 0 c L=[list(map(int,input().split())) for i in range(M)] [list(map(int,input().split())) for i in range(M)] L c+=1 1 c T=True True T P=list(map(int,input().split())) list(map(int,input().split())) P T=False False T s+=A[L[j][k+1]-1] A[L[j][k+1]-1] s N,M=map(int,input().split()) map(int,input().split()) N A=[0]*N [0]*N A s=0 0 s M=map(int,input().split()) map(int,input().split()) M
N,M=map(int,input().split())
L=[list(map(int,input().split())) for i in range(M)]
P=list(map(int,input().split()))
c=0
for i in range(2**N):
    A=[0]*N
    for j in range(N):
        if (i>>j&1):
            A[j]=1
    T=True
    for j in range(M):
        s=0
        for k in range(L[j][0]):
            s+=A[L[j][k+1]-1]
        if s%2!=P[j]:
            T=False
    if T:
        c+=1
print(c)