N,M = map(int,input().split())
light = [list(map(int,input().split())) for _ in range(M)]
p = list(map(int,input().split()))

cnt = 0
for i in range(2**N):
    b = [0]*N
    for j in range(N):
        if ((i >> j) & 1):
            b[j] = 1
    
    for k in range(M):
        num = 0
        for l in range(len(light[k])-1):
            num += b[light[k][l+1]-1] 
        if num%2 != p[k]:
            break
    else: cnt += 1
print(cnt) 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 light = [list(map(int,input().split())) for _ in range(M)] light [list(map(int,input().split())) for _ 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 cnt = 0 cnt 0 for i in range(2**N):
    b = [0]*N
    for j in range(N):
        if ((i >> j) & 1):
            b[j] = 1
    
    for k in range(M):
        num = 0
        for l in range(len(light[k])-1):
            num += b[light[k][l+1]-1] 
        if num%2 != p[k]:
            break
    else: cnt += 1 i range(2**N) range 2**N 2 N b = [0]*N b [0]*N [0] 0 N for j in range(N):
        if ((i >> j) & 1):
            b[j] = 1
    
     j range(N) range N if ((i >> j) & 1):
            b[j] = 1
    
     (i >> j) & 1 i >> j i j 1 b[j] = 1 b[j] b j 1 for k in range(M):
        num = 0
        for l in range(len(light[k])-1):
            num += b[light[k][l+1]-1] 
        if num%2 != p[k]:
            break
    else: cnt += 1 k range(M) range M num = 0 num 0 for l in range(len(light[k])-1):
            num += b[light[k][l+1]-1] 
         l range(len(light[k])-1) range len(light[k])-1 len(light[k]) len light[k] light k 1 num += b[light[k][l+1]-1] num b[light[k][l+1]-1] b light[k][l+1]-1 light[k][l+1] [k] light k l+1 l 1 1 if num%2 != p[k]:
            break
     num%2 != p[k] num%2 num 2 p[k] p k break print(cnt) print cnt p = list(map(int,input().split())) list(map(int,input().split())) p num = 0 0 num M = map(int,input().split()) map(int,input().split()) M N,M = map(int,input().split()) map(int,input().split()) N cnt = 0 0 cnt num += b[light[k][l+1]-1] b[light[k][l+1]-1] num light = [list(map(int,input().split())) for _ in range(M)] [list(map(int,input().split())) for _ in range(M)] light b = [0]*N [0]*N b
N,M = map(int,input().split())
light = [list(map(int,input().split())) for _ in range(M)]
p = list(map(int,input().split()))

cnt = 0
for i in range(2**N):
    b = [0]*N
    for j in range(N):
        if ((i >> j) & 1):
            b[j] = 1
    
    for k in range(M):
        num = 0
        for l in range(len(light[k])-1):
            num += b[light[k][l+1]-1] 
        if num%2 != p[k]:
            break
    else: cnt += 1
print(cnt)