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

ans = 0
str = '{:0'+str(n)+'b}'
for i in range(2**n):
  s = list(map(int, str.format(i)))
  b = True
  for j in range(m):
    if sum([x & y for x, y in zip(s, l[j])]) % 2 != p[j]:
      b = False
  if b:
    ans += 1

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

ans = 0
str = '{:0'+str(n)+'b}'
for i in range(2**n):
  s = list(map(int, str.format(i)))
  b = True
  for j in range(m):
    if sum([x & y for x, y in zip(s, l[j])]) % 2 != p[j]:
      b = False
  if b:
    ans += 1

print(ans) 