N,M = map(int,input().split())
array = []
for _ in range(M):
    array.append(list(map(int,input().split()))[1:])
P = list(map(int,input().split()))
count = 0
for mask in range(2**N):
    se = set()
    for i in range(N):
        if mask>>i & 1:
            se.add(i+1)
    for m in range(M):
        p = P[m]
        tmp = 0
        for j in array[m]:
            if j in se:
                tmp+=1
        if tmp%2!=p:
            break
    else:
        count+=1
print(count) N,M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M array = [] array [] for _ in range(M):
    array.append(list(map(int,input().split()))[1:]) _ range(M) range M array.append(list(map(int,input().split()))[1:]) array.append array append list(map(int,input().split()))[1:] (map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split 1: 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 count = 0 count 0 for mask in range(2**N):
    se = set()
    for i in range(N):
        if mask>>i & 1:
            se.add(i+1)
    for m in range(M):
        p = P[m]
        tmp = 0
        for j in array[m]:
            if j in se:
                tmp+=1
        if tmp%2!=p:
            break
    else:
        count+=1 mask range(2**N) range 2**N 2 N se = set() se set() set for i in range(N):
        if mask>>i & 1:
            se.add(i+1)
     i range(N) range N if mask>>i & 1:
            se.add(i+1)
     mask>>i & 1 mask>>i mask i 1 se.add(i+1) se.add se add i+1 i 1 for m in range(M):
        p = P[m]
        tmp = 0
        for j in array[m]:
            if j in se:
                tmp+=1
        if tmp%2!=p:
            break
    else:
        count+=1 m range(M) range M p = P[m] p P[m] P m tmp = 0 tmp 0 for j in array[m]:
            if j in se:
                tmp+=1
         j array[m] array m if j in se:
                tmp+=1
         j in se j se tmp+=1 tmp 1 if tmp%2!=p:
            break
     tmp%2!=p tmp%2 tmp 2 p break count+=1 count 1 print(count) print count array = [] [] array count+=1 1 count N,M = map(int,input().split()) map(int,input().split()) N se = set() set() se tmp+=1 1 tmp tmp = 0 0 tmp count = 0 0 count p = P[m] P[m] p P = list(map(int,input().split())) list(map(int,input().split())) P M = map(int,input().split()) map(int,input().split()) M
N,M = map(int,input().split())
array = []
for _ in range(M):
    array.append(list(map(int,input().split()))[1:])
P = list(map(int,input().split()))
count = 0
for mask in range(2**N):
    se = set()
    for i in range(N):
        if mask>>i & 1:
            se.add(i+1)
    for m in range(M):
        p = P[m]
        tmp = 0
        for j in array[m]:
            if j in se:
                tmp+=1
        if tmp%2!=p:
            break
    else:
        count+=1
print(count)