N, M = map(int, input().split())
k_s = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
ans=0
for i in range(2**N):
    for u in range(M):
        t=True
        num=0
        for y in range(1,len(k_s[u])):
            #print(bin(i),u,y-1,bin(i >> (y-1)))
            if ((i >> (k_s[u][y]-1)) & 1):
                num+=1
        if not num%2==p[u]:
            t=False
        if not t :
            break
    else:
        #print(bin(i))
        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 k_s = [list(map(int, input().split())) for i in range(M)] k_s [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):
    for u in range(M):
        t=True
        num=0
        for y in range(1,len(k_s[u])):
            #print(bin(i),u,y-1,bin(i >> (y-1)))
            if ((i >> (k_s[u][y]-1)) & 1):
                num+=1
        if not num%2==p[u]:
            t=False
        if not t :
            break
    else:
        #print(bin(i))
        ans+=1 i range(2**N) range 2**N 2 N for u in range(M):
        t=True
        num=0
        for y in range(1,len(k_s[u])):
            #print(bin(i),u,y-1,bin(i >> (y-1)))
            if ((i >> (k_s[u][y]-1)) & 1):
                num+=1
        if not num%2==p[u]:
            t=False
        if not t :
            break
    else:
        #print(bin(i))
        ans+=1 u range(M) range M t=True t True num=0 num 0 for y in range(1,len(k_s[u])):
            #print(bin(i),u,y-1,bin(i >> (y-1)))
            if ((i >> (k_s[u][y]-1)) & 1):
                num+=1
         y range(1,len(k_s[u])) range 1 len(k_s[u]) len k_s[u] k_s u if ((i >> (k_s[u][y]-1)) & 1):
                num+=1
         (i >> (k_s[u][y]-1)) & 1 i >> (k_s[u][y]-1) i k_s[u][y]-1 k_s[u][y] [u] k_s u y 1 1 num+=1 num 1 if not num%2==p[u]:
            t=False
         not num%2==p[u] num%2==p[u] num%2 num 2 p[u] p u t=False t False if not t :
            break
     not t t break ans+=1 ans 1 print(ans) print ans ans+=1 1 ans t=True True t num+=1 1 num ans=0 0 ans M = map(int, input().split()) map(int, input().split()) M p = list(map(int, input().split())) list(map(int, input().split())) p num=0 0 num N, M = map(int, input().split()) map(int, input().split()) N t=False False t k_s = [list(map(int, input().split())) for i in range(M)] [list(map(int, input().split())) for i in range(M)] k_s
N, M = map(int, input().split())
k_s = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))
ans=0
for i in range(2**N):
    for u in range(M):
        t=True
        num=0
        for y in range(1,len(k_s[u])):
            #print(bin(i),u,y-1,bin(i >> (y-1)))
            if ((i >> (k_s[u][y]-1)) & 1):
                num+=1
        if not num%2==p[u]:
            t=False
        if not t :
            break
    else:
        #print(bin(i))
        ans+=1
print(ans) 