n,m=map(int,input().split())
k=[[int(i) for i in input().split()] for j in range(m)]
p=[int(i) for i in input().split()]
ans=chk=0
for i in range(2**n):
    l=[0]*n
    for j in range(n):
        if i&1: l[j]=1
        i=i>>1
    y=0
    for j in range(m):
        x=0
        for a in range(k[j][0]):
            if l[k[j][a+1]-1]==1: x+=1
        if x%2==p[j]%2: y+=1
    if y==m: ans+=1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m [int(i) for i in input().split()] for j in range(m) for j in range(m) j range(m) range m for j in range(m) [int(i) for i in input().split()] k=[[int(i) for i in input().split()] for j in range(m)] k [[int(i) for i in input().split()] for j in range(m)] int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i p=[int(i) for i in input().split()] p [int(i) for i in input().split()] ans=chk=0 ans 0 =chk=0 chk 0 for i in range(2**n):
    l=[0]*n
    for j in range(n):
        if i&1: l[j]=1
        i=i>>1
    y=0
    for j in range(m):
        x=0
        for a in range(k[j][0]):
            if l[k[j][a+1]-1]==1: x+=1
        if x%2==p[j]%2: y+=1
    if y==m: ans+=1 i range(2**n) range 2**n 2 n l=[0]*n l [0]*n [0] 0 n for j in range(n):
        if i&1: l[j]=1
        i=i>>1
     j range(n) range n if i&1: l[j]=1
         i&1 i 1 i=i>>1 i i>>1 i 1 y=0 y 0 for j in range(m):
        x=0
        for a in range(k[j][0]):
            if l[k[j][a+1]-1]==1: x+=1
        if x%2==p[j]%2: y+=1
     j range(m) range m x=0 x 0 for a in range(k[j][0]):
            if l[k[j][a+1]-1]==1: x+=1
         a range(k[j][0]) range k[j][0] [j] k j 0 if l[k[j][a+1]-1]==1: x+=1
         l[k[j][a+1]-1]==1 l[k[j][a+1]-1] l k[j][a+1]-1 k[j][a+1] [j] k j a+1 a 1 1 1 if x%2==p[j]%2: y+=1
     x%2==p[j]%2 x%2 x 2 p[j]%2 p[j] p j 2 if y==m: an y==m y m print(ans) print ans k=[[int(i) for i in input().split()] for j in range(m)] [[int(i) for i in input().split()] for j in range(m)] k p=[int(i) for i in input().split()] [int(i) for i in input().split()] p l=[0]*n [0]*n l n,m=map(int,input().split()) map(int,input().split()) n y=0 0 y chk=0 0 chk i=i>>1 i>>1 i x=0 0 x m=map(int,input().split()) map(int,input().split()) m ans=chk=0 0 ans
n,m=map(int,input().split())
k=[[int(i) for i in input().split()] for j in range(m)]
p=[int(i) for i in input().split()]
ans=chk=0
for i in range(2**n):
    l=[0]*n
    for j in range(n):
        if i&1: l[j]=1
        i=i>>1
    y=0
    for j in range(m):
        x=0
        for a in range(k[j][0]):
            if l[k[j][a+1]-1]==1: x+=1
        if x%2==p[j]%2: y+=1
    if y==m: ans+=1
print(ans)
