N,M=map(int,input().split())
D=[]
for i in range(M):
  D.append(list(map(int,input().split())))
  D[-1]=D[-1][1:]
L=list(map(int,input().split()))
count=0
s=[]
for i in range(2**N):
  p = True
  for j in range(M):
    tmp = 0
    for k in range(N):
      if i>>k & 1:
        if k+1 in D[j]:
          tmp+=1
    if not L[j] == tmp%2:
      p = False
      break
  if p:
    s.append(bin(i))
    count+=1
print(count) N,M=map(int,input().split()) N map(int,input().split()) map int input().split() ().split () input split M D=[] D [] for i in range(M):
  D.append(list(map(int,input().split())))
  D[-1]=D[-1][1:] i range(M) range M D.append(list(map(int,input().split()))) D.append D append list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split D[-1]=D[-1][1:] D[-1] D -1 D[-1][1:] [-1] D -1 1: 1 L=list(map(int,input().split())) L list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split count=0 count 0 s=[] s [] for i in range(2**N):
  p = True
  for j in range(M):
    tmp = 0
    for k in range(N):
      if i>>k & 1:
        if k+1 in D[j]:
          tmp+=1
    if not L[j] == tmp%2:
      p = False
      break
  if p:
    s.append(bin(i))
    count+=1 i range(2**N) range 2**N 2 N p = True p True for j in range(M):
    tmp = 0
    for k in range(N):
      if i>>k & 1:
        if k+1 in D[j]:
          tmp+=1
    if not L[j] == tmp%2:
      p = False
      break
   j range(M) range M tmp = 0 tmp 0 for k in range(N):
      if i>>k & 1:
        if k+1 in D[j]:
          tmp+=1
     k range(N) range N if i>>k & 1:
        if k+1 in D[j]:
          tmp+=1
     i>>k & 1 i>>k i k 1 if k+1 in D[j]:
          tmp+=1
     k+1 in D[j] k+1 k 1 D[j] D j tmp+=1 tmp 1 if not L[j] == tmp%2:
      p = False
      break
   not L[j] == tmp%2 L[j] == tmp%2 L[j] L j tmp%2 tmp 2 p = False p False break if p:
    s.append(bin(i))
    count+=1 p s.append(bin(i)) s.append s append bin(i) bin i count+=1 count 1 print(count) print count p = False False p D=[] [] D L=list(map(int,input().split())) list(map(int,input().split())) L tmp = 0 0 tmp N,M=map(int,input().split()) map(int,input().split()) N count+=1 1 count p = True True p tmp+=1 1 tmp count=0 0 count s=[] [] s M=map(int,input().split()) map(int,input().split()) M
N,M=map(int,input().split())
D=[]
for i in range(M):
  D.append(list(map(int,input().split())))
  D[-1]=D[-1][1:]
L=list(map(int,input().split()))
count=0
s=[]
for i in range(2**N):
  p = True
  for j in range(M):
    tmp = 0
    for k in range(N):
      if i>>k & 1:
        if k+1 in D[j]:
          tmp+=1
    if not L[j] == tmp%2:
      p = False
      break
  if p:
    s.append(bin(i))
    count+=1
print(count)