n,m=map(int,input().split())
denkyu_switch=[]
res=0
for i in range(m):
    denkyu_switch+=[list(map(int, input().split()))[1:]]
p=list(map(int, input().split()))
for i in range(2**n):
    denkyu = [0] * m
    for j in range(n):
        if i>>j & 1:
            for k in range(m):
                if j+1 in denkyu_switch[k]:
                    denkyu[k]+=1
    denkyu2=[i%2 for i in denkyu]
    if p==denkyu2:
        res+=1
print(res) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m denkyu_switch=[] denkyu_switch [] res=0 res 0 for i in range(m):
    denkyu_switch+=[list(map(int, input().split()))[1:]] i range(m) range m denkyu_switch+=[list(map(int, input().split()))[1:]] denkyu_switch [list(map(int, input().split()))[1:]] 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 for i in range(2**n):
    denkyu = [0] * m
    for j in range(n):
        if i>>j & 1:
            for k in range(m):
                if j+1 in denkyu_switch[k]:
                    denkyu[k]+=1
    denkyu2=[i%2 for i in denkyu]
    if p==denkyu2:
        res+=1 i range(2**n) range 2**n 2 n denkyu = [0] * m denkyu [0] * m [0] 0 m for j in range(n):
        if i>>j & 1:
            for k in range(m):
                if j+1 in denkyu_switch[k]:
                    denkyu[k]+=1
     j range(n) range n if i>>j & 1:
            for k in range(m):
                if j+1 in denkyu_switch[k]:
                    denkyu[k]+=1
     i>>j & 1 i>>j i j 1 for k in range(m):
                if j+1 in denkyu_switch[k]:
                    denkyu[k]+=1
     k range(m) range m if j+1 in denkyu_switch[k]:
                    denkyu[k]+=1
     j+1 in denkyu_switch[k] j+1 j 1 denkyu_switch[k] denkyu_switch k denkyu[k]+=1 denkyu[k] denkyu k 1 i%2 for i in denkyu for i in denkyu i denkyu for i in denkyu i%2 i 2 denkyu2=[i%2 for i in denkyu] denkyu2 [i%2 for i in denkyu] if p==denkyu2:
        res+=1 p==denkyu2 p denkyu2 res+=1 res 1 print(res) print res res+=1 1 res denkyu_switch=[] [] denkyu_switch res=0 0 res denkyu_switch+=[list(map(int, input().split()))[1:]] [list(map(int, input().split()))[1:]] denkyu_switch 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()) map(int,input().split()) n denkyu = [0] * m [0] * m denkyu denkyu2=[i%2 for i in denkyu] [i%2 for i in denkyu] denkyu2
n,m=map(int,input().split())
denkyu_switch=[]
res=0
for i in range(m):
    denkyu_switch+=[list(map(int, input().split()))[1:]]
p=list(map(int, input().split()))
for i in range(2**n):
    denkyu = [0] * m
    for j in range(n):
        if i>>j & 1:
            for k in range(m):
                if j+1 in denkyu_switch[k]:
                    denkyu[k]+=1
    denkyu2=[i%2 for i in denkyu]
    if p==denkyu2:
        res+=1
print(res)
