N, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
ans=0
for i in range(2**N):
    a=[]
    flag=0
    for j in range(N):
        if (i>>j)&1:
            a.append(j+1)
    for k in range(M):
        cnt=0
        for l in range(A[k][0]):
            if A[k][l+1] in a:
                cnt+=1
        if cnt%2!=p[k]:
            flag=1
    if flag==0:
        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 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 A = [list(map(int, input().split())) for i in range(M)] A [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 ans=0 ans 0 for i in range(2**N):
    a=[]
    flag=0
    for j in range(N):
        if (i>>j)&1:
            a.append(j+1)
    for k in range(M):
        cnt=0
        for l in range(A[k][0]):
            if A[k][l+1] in a:
                cnt+=1
        if cnt%2!=p[k]:
            flag=1
    if flag==0:
        ans+=1
     i range(2**N) range 2**N 2 N a=[] a [] flag=0 flag 0 for j in range(N):
        if (i>>j)&1:
            a.append(j+1)
     j range(N) range N if (i>>j)&1:
            a.append(j+1)
     (i>>j)&1 i>>j i j 1 a.append(j+1) a.append a append j+1 j 1 for k in range(M):
        cnt=0
        for l in range(A[k][0]):
            if A[k][l+1] in a:
                cnt+=1
        if cnt%2!=p[k]:
            flag=1
     k range(M) range M cnt=0 cnt 0 for l in range(A[k][0]):
            if A[k][l+1] in a:
                cnt+=1
         l range(A[k][0]) range A[k][0] [k] A k 0 if A[k][l+1] in a:
                cnt+=1
         A[k][l+1] in a A[k][l+1] [k] A k l+1 l 1 a cnt+=1 cnt 1 if cnt%2!=p[k]:
            flag=1
     cnt%2!=p[k] cnt%2 cnt 2 p[k] p k flag=1 flag 1 if flag==0:
        ans+=1
     flag==0 flag 0 ans+=1 ans 1 print(ans) print ans p = list(map(int, input().split())) list(map(int, input().split())) p cnt+=1 1 cnt flag=1 1 flag A = [list(map(int, input().split())) for i in range(M)] [list(map(int, input().split())) for i in range(M)] A a=[] [] a ans+=1 1 ans M = map(int, input().split()) map(int, input().split()) M N, M = map(int, input().split()) map(int, input().split()) N flag=0 0 flag cnt=0 0 cnt ans=0 0 ans
N, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
ans=0
for i in range(2**N):
    a=[]
    flag=0
    for j in range(N):
        if (i>>j)&1:
            a.append(j+1)
    for k in range(M):
        cnt=0
        for l in range(A[k][0]):
            if A[k][l+1] in a:
                cnt+=1
        if cnt%2!=p[k]:
            flag=1
    if flag==0:
        ans+=1
    
print(ans)
