n, m  = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
d = [0]*(n+1)
s = 0
for i in range(2**n):
  for j in range(n):
    if i & (1<<j):
      d[j+1] = 1
    else:
      d[j+1] = 0
  for k in range(m):
    a = 0
    for l in range(1, lst[k][0]+1):
      a = (a+d[lst[k][l]])%2
    if a!=p[k]:
      break
  else:
    s += 1

print(s) 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 i in range(m) for i in range(m) i range(m) range m for i in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split lst = [list(map(int, input().split())) for i in range(m)] lst [list(map(int, input().split())) for i in range(m)] p = list(map(int, input().split())) p list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split d = [0]*(n+1) d [0]*(n+1) [0] 0 n+1 n 1 s = 0 s 0 for i in range(2**n):
  for j in range(n):
    if i & (1<<j):
      d[j+1] = 1
    else:
      d[j+1] = 0
  for k in range(m):
    a = 0
    for l in range(1, lst[k][0]+1):
      a = (a+d[lst[k][l]])%2
    if a!=p[k]:
      break
  else:
    s += 1 i range(2**n) range 2**n 2 n for j in range(n):
    if i & (1<<j):
      d[j+1] = 1
    else:
      d[j+1] = 0
   j range(n) range n if i & (1<<j):
      d[j+1] = 1
    else:
      d[j+1] = 0
   i & (1<<j) i 1<<j 1 j d[j+1] = 1 d[j+1] d j+1 j 1 1 d[j+1] = 0 d[j+1] d j+1 j 1 0 for k in range(m):
    a = 0
    for l in range(1, lst[k][0]+1):
      a = (a+d[lst[k][l]])%2
    if a!=p[k]:
      break
  else:
    s += 1 k range(m) range m a = 0 a 0 for l in range(1, lst[k][0]+1):
      a = (a+d[lst[k][l]])%2
     l range(1, lst[k][0]+1) range 1 lst[k][0]+1 lst[k][0] [k] lst k 0 1 a = (a+d[lst[k][l]])%2 a (a+d[lst[k][l]])%2 a+d[lst[k][l]] a d[lst[k][l]] d lst[k][l] [k] lst k l 2 if a!=p[k]:
      break
   a!=p[k] a p[k] p k break s += 1 s 1 print(s) print s a = 0 0 a a = (a+d[lst[k][l]])%2 (a+d[lst[k][l]])%2 a p = list(map(int, input().split())) list(map(int, input().split())) p s = 0 0 s s += 1 1 s n, m  = map(int, input().split()) map(int, input().split()) n lst = [list(map(int, input().split())) for i in range(m)] [list(map(int, input().split())) for i in range(m)] lst d = [0]*(n+1) [0]*(n+1) d m  = map(int, input().split()) map(int, input().split()) m
n, m  = map(int, input().split())
lst = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))
d = [0]*(n+1)
s = 0
for i in range(2**n):
  for j in range(n):
    if i & (1<<j):
      d[j+1] = 1
    else:
      d[j+1] = 0
  for k in range(m):
    a = 0
    for l in range(1, lst[k][0]+1):
      a = (a+d[lst[k][l]])%2
    if a!=p[k]:
      break
  else:
    s += 1

print(s)