#!/usr/bin/python3
#coding: utf-8

N, M = (int(x) for x in input().split())

S = []
for i in range(M):
    S.append([int(x)-1 for x in input().split()][1:])
P = [int(x) for x in input().split()]

ret = 0
for bit in range(2**N):
    on = [i for i in range(N) if bit & (1 << i)]
    if all(sum(1 for switch in S[i] if switch in on) % 2 == P[i] for i in range(M)):
        ret += 1
print(ret) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x N, M = (int(x) for x in input().split()) N (int(x) for x in input().split()) M S = [] S [] for i in range(M):
    S.append([int(x)-1 for x in input().split()][1:]) i range(M) range M int(x)-1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x)-1 int(x) int x 1 S.append([int(x)-1 for x in input().split()][1:]) S.append S append [int(x)-1 for x in input().split()][1:] [int(x)-1 for x in input().split()] 1: 1 int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x P = [int(x) for x in input().split()] P [int(x) for x in input().split()] ret = 0 ret 0 for bit in range(2**N):
    on = [i for i in range(N) if bit & (1 << i)]
    if all(sum(1 for switch in S[i] if switch in on) % 2 == P[i] for i in range(M)):
        ret += 1 bit range(2**N) range 2**N 2 N i for i in range(N) if bit & (1 << i) for i in range(N) if bit & (1 << i) i range(N) range N bit & (1 << i) bit 1 << i 1 i if bit & (1 << i) i on = [i for i in range(N) if bit & (1 << i)] on [i for i in range(N) if bit & (1 << i)] if all(sum(1 for switch in S[i] if switch in on) % 2 == P[i] for i in range(M)):
        ret += 1 all(sum(1 for switch in S[i] if switch in on) % 2 == P[i] for i in range(M)) all sum(1 for switch in S[i] if switch in on) % 2 == P[i] sum(1 for switch in S[i] if switch in on) % 2 sum(1 for switch in S[i] if switch in on) sum 1 2 P[i] P i ret += 1 ret 1 print(ret) print ret N, M = (int(x) for x in input().split()) (int(x) for x in input().split()) N P = [int(x) for x in input().split()] [int(x) for x in input().split()] P M = (int(x) for x in input().split()) (int(x) for x in input().split()) M S = [] [] S on = [i for i in range(N) if bit & (1 << i)] [i for i in range(N) if bit & (1 << i)] on ret += 1 1 ret ret = 0 0 ret
#!/usr/bin/python3
#coding: utf-8

N, M = (int(x) for x in input().split())

S = []
for i in range(M):
    S.append([int(x)-1 for x in input().split()][1:])
P = [int(x) for x in input().split()]

ret = 0
for bit in range(2**N):
    on = [i for i in range(N) if bit & (1 << i)]
    if all(sum(1 for switch in S[i] if switch in on) % 2 == P[i] for i in range(M)):
        ret += 1
print(ret)
