n,m=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    ss=[0]*n
    cc=0
    for j in range(n):
        if i>>j&1:
            ss[j]=1
    for j in range(m):
        c=0
        k=s[j][0]
        for l in range(1,k+1):
            c+=ss[s[j][l]-1]
        if c%2==p[j]:
            cc+=1
    if cc==m:
        ans+=1
print(ans)

            
 n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m list(map(int,input().split())) for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split s=[list(map(int,input().split())) for _ in range(m)] s [list(map(int,input().split())) for _ in range(m)] p=list(map(int,input().split())) p list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans=0 ans 0 for i in range(2**n):
    ss=[0]*n
    cc=0
    for j in range(n):
        if i>>j&1:
            ss[j]=1
    for j in range(m):
        c=0
        k=s[j][0]
        for l in range(1,k+1):
            c+=ss[s[j][l]-1]
        if c%2==p[j]:
            cc+=1
    if cc==m:
        ans+=1 i range(2**n) range 2**n 2 n ss=[0]*n ss [0]*n [0] 0 n cc=0 cc 0 for j in range(n):
        if i>>j&1:
            ss[j]=1
     j range(n) range n if i>>j&1:
            ss[j]=1
     i>>j&1 i>>j i j 1 ss[j]=1 ss[j] ss j 1 for j in range(m):
        c=0
        k=s[j][0]
        for l in range(1,k+1):
            c+=ss[s[j][l]-1]
        if c%2==p[j]:
            cc+=1
     j range(m) range m c=0 c 0 k=s[j][0] k s[j][0] [j] s j 0 for l in range(1,k+1):
            c+=ss[s[j][l]-1]
         l range(1,k+1) range 1 k+1 k 1 c+=ss[s[j][l]-1] c ss[s[j][l]-1] ss s[j][l]-1 s[j][l] [j] s j l 1 if c%2==p[j]:
            cc+=1
     c%2==p[j] c%2 c 2 p[j] p j cc+=1 cc 1 if cc==m:
        ans+=1 cc==m cc m ans+=1 ans 1 print(ans) print ans m=map(int,input().split()) map(int,input().split()) m s=[list(map(int,input().split())) for _ in range(m)] [list(map(int,input().split())) for _ in range(m)] s ans=0 0 ans c+=ss[s[j][l]-1] ss[s[j][l]-1] c p=list(map(int,input().split())) list(map(int,input().split())) p cc=0 0 cc cc+=1 1 cc n,m=map(int,input().split()) map(int,input().split()) n ss=[0]*n [0]*n ss k=s[j][0] s[j][0] k ans+=1 1 ans c=0 0 c
n,m=map(int,input().split())
s=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    ss=[0]*n
    cc=0
    for j in range(n):
        if i>>j&1:
            ss[j]=1
    for j in range(m):
        c=0
        k=s[j][0]
        for l in range(1,k+1):
            c+=ss[s[j][l]-1]
        if c%2==p[j]:
            cc+=1
    if cc==m:
        ans+=1
print(ans)

            

