from itertools import product

n, m = map(int, input().split())
sp = [list(map(int, input().split())) for _ in range(m + 1)]
print(sum(all(sum(i[a - 1] for a in s[1:]) % 2 == p for s, p in zip(sp[:m], sp[-1])) for i in product((0, 1), repeat=n))) from itertools import product 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 _ in range(m + 1) for _ in range(m + 1) _ range(m + 1) range m + 1 m 1 for _ in range(m + 1) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split sp = [list(map(int, input().split())) for _ in range(m + 1)] sp [list(map(int, input().split())) for _ in range(m + 1)] print(sum(all(sum(i[a - 1] for a in s[1:]) % 2 == p for s, p in zip(sp[:m], sp[-1])) for i in product((0, 1), repeat=n))) print sum(all(sum(i[a - 1] for a in s[1:]) % 2 == p for s, p in zip(sp[:m], sp[-1])) for i in product((0, 1), repeat=n)) sum all(sum(i[a - 1] for a in s[1:]) % 2 == p for s, p in zip(sp[:m], sp[-1])) all sum(i[a - 1] for a in s[1:]) % 2 == p sum(i[a - 1] for a in s[1:]) % 2 sum(i[a - 1] for a in s[1:]) sum i[a - 1] i a - 1 a 1 2 p sp = [list(map(int, input().split())) for _ in range(m + 1)] [list(map(int, input().split())) for _ in range(m + 1)] sp n, m = map(int, input().split()) map(int, input().split()) n m = map(int, input().split()) map(int, input().split()) m
from itertools import product

n, m = map(int, input().split())
sp = [list(map(int, input().split())) for _ in range(m + 1)]
print(sum(all(sum(i[a - 1] for a in s[1:]) % 2 == p for s, p in zip(sp[:m], sp[-1])) for i in product((0, 1), repeat=n)))