n,m = map(int,input().split())
s = [0] * m
k = [0] * m
for i in range(m):
    s[i] = list(map(int,input().split()))
    k[i] = s[0]
    s[i] = s[i][1:]
p = list(map(int,input().split()))

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

ans = 0
b = '0' + str(n) + 'b'
for i in range(1 << n):
    sw = format(i,b)
    if all(sum(sw[g-1] == '1' for g in s[j])%2 == p[j] for j in range(m)):
        ans += 1
print(ans)
