def light(l,i):
    k=1<<(i-1)
    if l&k:
        return 1
    else:
        return 0

N, M = map(int,input().split())
s=list()
for j in range(0,M):
    s.append(0)
for j in range(0,M):
    s[j]=list(map(int,input().split()))
p=list(map(int,input().split()))

a=0
for l in range(0,1<<N):
    b=0
    for j in range(0,M):
        c=0
        for i in range(1,s[j][0]+1):
            c+=light(l,s[j][i])
        if c%2==p[j]:
            b+=1
    if b==M:
        a+=1
print(a) def light(l,i):
    k=1<<(i-1)
    if l&k:
        return 1
    else:
        return 0 light k=1<<(i-1) k 1<<(i-1) 1 i-1 i 1 if l&k:
        return 1
    else:
        return 0 l&k l k return 1 1 return 0 0 l l i i N, M = map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M s=list() s list() list for j in range(0,M):
    s.append(0) j range(0,M) range 0 M s.append(0) s.append s append 0 for j in range(0,M):
    s[j]=list(map(int,input().split())) j range(0,M) range 0 M s[j]=list(map(int,input().split())) s[j] s j list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split p=list(map(int,input().split())) p list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split a=0 a 0 for l in range(0,1<<N):
    b=0
    for j in range(0,M):
        c=0
        for i in range(1,s[j][0]+1):
            c+=light(l,s[j][i])
        if c%2==p[j]:
            b+=1
    if b==M:
        a+=1 l range(0,1<<N) range 0 1<<N 1 N b=0 b 0 for j in range(0,M):
        c=0
        for i in range(1,s[j][0]+1):
            c+=light(l,s[j][i])
        if c%2==p[j]:
            b+=1
     j range(0,M) range 0 M c=0 c 0 for i in range(1,s[j][0]+1):
            c+=light(l,s[j][i])
         i range(1,s[j][0]+1) range 1 s[j][0]+1 s[j][0] [j] s j 0 1 c+=light(l,s[j][i]) c light(l,s[j][i]) light l s[j][i] [j] s j i if c%2==p[j]:
            b+=1
     c%2==p[j] c%2 c 2 p[j] p j b+=1 b 1 if b==M:
        a+=1 b==M b M a+=1 a 1 print(a) print a c+=light(l,s[j][i]) light(l,s[j][i]) c a=0 0 a b=0 0 b b+=1 1 b def light(l,i):
    k=1<<(i-1)
    if l&k:
        return 1
    else:
        return 0 def light(l,i):
    k=1<<(i-1)
    if l&k:
        return 1
    else:
        return 0 light N, M = map(int,input().split()) map(int,input().split()) N c=0 0 c a+=1 1 a M = map(int,input().split()) map(int,input().split()) M s=list() list() s p=list(map(int,input().split())) list(map(int,input().split())) p
def light(l,i):
    k=1<<(i-1)
    if l&k:
        return 1
    else:
        return 0

N, M = map(int,input().split())
s=list()
for j in range(0,M):
    s.append(0)
for j in range(0,M):
    s[j]=list(map(int,input().split()))
p=list(map(int,input().split()))

a=0
for l in range(0,1<<N):
    b=0
    for j in range(0,M):
        c=0
        for i in range(1,s[j][0]+1):
            c+=light(l,s[j][i])
        if c%2==p[j]:
            b+=1
    if b==M:
        a+=1
print(a)