n,m=map(int,input().split())
light=[]
ans=0
for i in range(m):
    List=list(map(int,input().split()))
    light.append(List)
p=list(map(int,input().split()))

for i in range(2**n):
    l=[0]*n
    for j in range(n):
        if (i>>j&1):
            l[j]=1
    on=0
    for k in range(m):
        cnt=0
        for o in range(1,len(light[k])):
            if (l[light[k][o]-1]==1):
                cnt+=1
        if cnt%2==p[k]:
            on+=1
    if on==m:
        ans+=1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m light=[] light [] ans=0 ans 0 for i in range(m):
    List=list(map(int,input().split()))
    light.append(List) i range(m) range m List=list(map(int,input().split())) List list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split light.append(List) light.append light append List p=list(map(int,input().split())) p list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(2**n):
    l=[0]*n
    for j in range(n):
        if (i>>j&1):
            l[j]=1
    on=0
    for k in range(m):
        cnt=0
        for o in range(1,len(light[k])):
            if (l[light[k][o]-1]==1):
                cnt+=1
        if cnt%2==p[k]:
            on+=1
    if on==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>>j&1):
            l[j]=1
     j range(n) range n if (i>>j&1):
            l[j]=1
     i>>j&1 i>>j i j 1 l[j]=1 l[j] l j 1 on=0 on 0 for k in range(m):
        cnt=0
        for o in range(1,len(light[k])):
            if (l[light[k][o]-1]==1):
                cnt+=1
        if cnt%2==p[k]:
            on+=1
     k range(m) range m cnt=0 cnt 0 for o in range(1,len(light[k])):
            if (l[light[k][o]-1]==1):
                cnt+=1
         o range(1,len(light[k])) range 1 len(light[k]) len light[k] light k if (l[light[k][o]-1]==1):
                cnt+=1
         l[light[k][o]-1]==1 l[light[k][o]-1] l light[k][o]-1 light[k][o] [k] light k o 1 1 cnt+=1 cnt 1 if cnt%2==p[k]:
            on+=1
     cnt%2==p[k] cnt%2 cnt 2 p[k] p k on+=1 on 1 if on==m:
        ans+=1 on==m on m ans+=1 ans 1 print(ans) print ans l=[0]*n [0]*n l ans+=1 1 ans cnt+=1 1 cnt m=map(int,input().split()) map(int,input().split()) m ans=0 0 ans on=0 0 on on+=1 1 on List=list(map(int,input().split())) list(map(int,input().split())) List p=list(map(int,input().split())) list(map(int,input().split())) p n,m=map(int,input().split()) map(int,input().split()) n light=[] [] light cnt=0 0 cnt
n,m=map(int,input().split())
light=[]
ans=0
for i in range(m):
    List=list(map(int,input().split()))
    light.append(List)
p=list(map(int,input().split()))

for i in range(2**n):
    l=[0]*n
    for j in range(n):
        if (i>>j&1):
            l[j]=1
    on=0
    for k in range(m):
        cnt=0
        for o in range(1,len(light[k])):
            if (l[light[k][o]-1]==1):
                cnt+=1
        if cnt%2==p[k]:
            on+=1
    if on==m:
        ans+=1
print(ans)