#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n, m = [int(x) for x in input().split()]
s = [[int(x) - 1 for x in input().split()][1:] for i in range(m)]
p = [int(x) for x in input().split()]
print(sum(1 for mask in range(1 << n) if all(sum((mask >> bulb) & 1 for bulb in s[i]) % 2 == p[i] for i in range(m)))) import sys sys input = lambda: sys.stdin.readline().strip() input lambda: sys.stdin.readline().strip() sys.stdin.readline().strip() sys.stdin.readline().strip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline strip 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 [int(x) - 1 for x in input().split()][1:] for i in range(m) for i in range(m) i range(m) range m for i in range(m) [int(x) - 1 for x in input().split()][1:] [int(x) - 1 for x in input().split()] 1: 1 s = [[int(x) - 1 for x in input().split()][1:] for i in range(m)] s [[int(x) - 1 for x in input().split()][1:] for i in range(m)] 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()] print(sum(1 for mask in range(1 << n) if all(sum((mask >> bulb) & 1 for bulb in s[i]) % 2 == p[i] for i in range(m)))) print sum(1 for mask in range(1 << n) if all(sum((mask >> bulb) & 1 for bulb in s[i]) % 2 == p[i] for i in range(m))) sum 1 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 input = lambda: sys.stdin.readline().strip() lambda: sys.stdin.readline().strip() input m = [int(x) for x in input().split()] [int(x) for x in input().split()] m s = [[int(x) - 1 for x in input().split()][1:] for i in range(m)] [[int(x) - 1 for x in input().split()][1:] for i in range(m)] s
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
n, m = [int(x) for x in input().split()]
s = [[int(x) - 1 for x in input().split()][1:] for i in range(m)]
p = [int(x) for x in input().split()]
print(sum(1 for mask in range(1 << n) if all(sum((mask >> bulb) & 1 for bulb in s[i]) % 2 == p[i] for i in range(m))))