n,m = map(int,input().split())
s = [0] * m
ans = 0
for i in range(m):
    s[i] = list(map(int,input().split()))
    s[i] = s[i][1:]
p = list(map(int,input().split()))
for k in range(2**n):
    a = format(k,'0'+str(n)+'b')
    t = True
    for i in range(m):
        if sum(a[j-1] == '1' for j in s[i])%2 != p[i]:
            t = False
            break
    ans += t
print(ans) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m s = [0] * m s [0] * m [0] 0 m ans = 0 ans 0 for i in range(m):
    s[i] = list(map(int,input().split()))
    s[i] = s[i][1:] i range(m) range m s[i] = list(map(int,input().split())) s[i] s i list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split s[i] = s[i][1:] s[i] s i s[i][1:] [i] s i 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 k in range(2**n):
    a = format(k,'0'+str(n)+'b')
    t = True
    for i in range(m):
        if sum(a[j-1] == '1' for j in s[i])%2 != p[i]:
            t = False
            break
    ans += t k range(2**n) range 2**n 2 n a = format(k,'0'+str(n)+'b') a format(k,'0'+str(n)+'b') format k '0'+str(n)+'b' '0'+str(n) '0' str(n) str n 'b' t = True t True for i in range(m):
        if sum(a[j-1] == '1' for j in s[i])%2 != p[i]:
            t = False
            break
     i range(m) range m if sum(a[j-1] == '1' for j in s[i])%2 != p[i]:
            t = False
            break
     sum(a[j-1] == '1' for j in s[i])%2 != p[i] sum(a[j-1] == '1' for j in s[i])%2 sum(a[j-1] == '1' for j in s[i]) sum a[j-1] == '1' a[j-1] a j-1 j 1 '1' 2 p[i] p i t = False t False break ans += t ans t print(ans) print ans ans = 0 0 ans s = [0] * m [0] * m s n,m = map(int,input().split()) map(int,input().split()) n a = format(k,'0'+str(n)+'b') format(k,'0'+str(n)+'b') a t = True True t ans += t t ans m = map(int,input().split()) map(int,input().split()) m p = list(map(int,input().split())) list(map(int,input().split())) p t = False False t
n,m = map(int,input().split())
s = [0] * m
ans = 0
for i in range(m):
    s[i] = list(map(int,input().split()))
    s[i] = s[i][1:]
p = list(map(int,input().split()))
for k in range(2**n):
    a = format(k,'0'+str(n)+'b')
    t = True
    for i in range(m):
        if sum(a[j-1] == '1' for j in s[i])%2 != p[i]:
            t = False
            break
    ans += t
print(ans)
