N,M=map(int,input().split())
lights=[]
for _ in range(M):
    number=list(map(int,input().split()))
    lights.append(number[1:])
p=list(map(int,input().split()))
switches=[n for n in range(1,N+1)]
kouho=[]
n=len(switches)
for i in range(2**n):
    switch=[]
    for j in range(n):
        if ((i>>j)&1):
            switch.append(switches[j])
    kouho.append(switch)
del kouho[0]
ans=0
for kou in kouho:
    numbers=[0 for _ in range(M)]
    for k in kou:
        for n in range(M):
            if k in lights[n]:
                numbers[n]+=1
    for n in range(M):
        numbers[n]=numbers[n]%2
    if numbers==p:
        ans+=1
if p ==[0 for _ in range(M)]:
    ans+=1
print(ans) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M lights=[] lights [] for _ in range(M):
    number=list(map(int,input().split()))
    lights.append(number[1:]) _ range(M) range M number=list(map(int,input().split())) number list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split lights.append(number[1:]) lights.append lights append number[1:] number 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 n for n in range(1,N+1) for n in range(1,N+1) n range(1,N+1) range 1 N+1 N 1 for n in range(1,N+1) n switches=[n for n in range(1,N+1)] switches [n for n in range(1,N+1)] kouho=[] kouho [] n=len(switches) n len(switches) len switches for i in range(2**n):
    switch=[]
    for j in range(n):
        if ((i>>j)&1):
            switch.append(switches[j])
    kouho.append(switch) i range(2**n) range 2**n 2 n switch=[] switch [] for j in range(n):
        if ((i>>j)&1):
            switch.append(switches[j])
     j range(n) range n if ((i>>j)&1):
            switch.append(switches[j])
     (i>>j)&1 i>>j i j 1 switch.append(switches[j]) switch.append switch append switches[j] switches j kouho.append(switch) kouho.append kouho append switch del kouho[0] kouho[0] kouho 0 ans=0 ans 0 for kou in kouho:
    numbers=[0 for _ in range(M)]
    for k in kou:
        for n in range(M):
            if k in lights[n]:
                numbers[n]+=1
    for n in range(M):
        numbers[n]=numbers[n]%2
    if numbers==p:
        ans+=1 kou kouho 0 for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) 0 numbers=[0 for _ in range(M)] numbers [0 for _ in range(M)] for k in kou:
        for n in range(M):
            if k in lights[n]:
                numbers[n]+=1
     k kou for n in range(M):
            if k in lights[n]:
                numbers[n]+=1
     n range(M) range M if k in lights[n]:
                numbers[n]+=1
     k in lights[n] k lights[n] lights n numbers[n]+=1 numbers[n] numbers n 1 for n in range(M):
        numbers[n]=numbers[n]%2
     n range(M) range M numbers[n]=numbers[n]%2 numbers[n] numbers n numbers[n]%2 numbers[n] numbers n 2 if numbers==p:
        ans+=1 numbers==p numbers p ans+=1 ans 1 if p ==[0 for _ in range(M)]:
    ans+=1 p ==[0 for _ in range(M)] p [0 for _ in range(M)] ans+=1 ans 1 print(ans) print ans switch=[] [] switch N,M=map(int,input().split()) map(int,input().split()) N switches=[n for n in range(1,N+1)] [n for n in range(1,N+1)] switches ans=0 0 ans ans+=1 1 ans M=map(int,input().split()) map(int,input().split()) M p=list(map(int,input().split())) list(map(int,input().split())) p n=len(switches) len(switches) n number=list(map(int,input().split())) list(map(int,input().split())) number ans+=1 1 ans kouho=[] [] kouho numbers=[0 for _ in range(M)] [0 for _ in range(M)] numbers lights=[] [] lights
N,M=map(int,input().split())
lights=[]
for _ in range(M):
    number=list(map(int,input().split()))
    lights.append(number[1:])
p=list(map(int,input().split()))
switches=[n for n in range(1,N+1)]
kouho=[]
n=len(switches)
for i in range(2**n):
    switch=[]
    for j in range(n):
        if ((i>>j)&1):
            switch.append(switches[j])
    kouho.append(switch)
del kouho[0]
ans=0
for kou in kouho:
    numbers=[0 for _ in range(M)]
    for k in kou:
        for n in range(M):
            if k in lights[n]:
                numbers[n]+=1
    for n in range(M):
        numbers[n]=numbers[n]%2
    if numbers==p:
        ans+=1
if p ==[0 for _ in range(M)]:
    ans+=1
print(ans)
