n,m = map(int,input().split())
ks = [list(map(int,input().split())) for i in range(m)]
p = list(map(int,input().split()))


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


ans = 0
for i in range(2**n):
    s = 0
    for j in range(m):
        c = 0
        for k in range(len(ks[j])-1) :
            if ((i >> (ks[j][k+1]-1)) & 1) :
                c += 1
        if c % 2 == p[j]:
            s += 1
    if s == m :
        ans += 1

print(ans)
