n,m=map(int,input().split())
a=[]
ans=0
for _ in range(m):
  t=list(map(int,input().split()))
  t.pop(0)
  a.append(t)
b=list(map(int,input().split()))
for i in range(2**n):
  c=[0]*m
  for j in range(n):
     if ((i>>j) & 1):
        for k in range(len(a)):
          if (j+1) in a[k]:
            c[k]+=1
  flg=0
  for j in range(m):
    if c[j]%2!=b[j]:
      flg=1
  if flg==0:
    ans+=1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m a=[] a [] ans=0 ans 0 for _ in range(m):
  t=list(map(int,input().split()))
  t.pop(0)
  a.append(t) _ range(m) range m t=list(map(int,input().split())) t list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split t.pop(0) t.pop t pop 0 a.append(t) a.append a append t b=list(map(int,input().split())) b list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(2**n):
  c=[0]*m
  for j in range(n):
     if ((i>>j) & 1):
        for k in range(len(a)):
          if (j+1) in a[k]:
            c[k]+=1
  flg=0
  for j in range(m):
    if c[j]%2!=b[j]:
      flg=1
  if flg==0:
    ans+=1 i range(2**n) range 2**n 2 n c=[0]*m c [0]*m [0] 0 m for j in range(n):
     if ((i>>j) & 1):
        for k in range(len(a)):
          if (j+1) in a[k]:
            c[k]+=1
   j range(n) range n if ((i>>j) & 1):
        for k in range(len(a)):
          if (j+1) in a[k]:
            c[k]+=1
   (i>>j) & 1 i>>j i j 1 for k in range(len(a)):
          if (j+1) in a[k]:
            c[k]+=1
   k range(len(a)) range len(a) len a if (j+1) in a[k]:
            c[k]+=1
   (j+1) in a[k] j+1 j 1 a[k] a k c[k]+=1 c[k] c k 1 flg=0 flg 0 for j in range(m):
    if c[j]%2!=b[j]:
      flg=1
   j range(m) range m if c[j]%2!=b[j]:
      flg=1
   c[j]%2!=b[j] c[j]%2 c[j] c j 2 b[j] b j flg=1 flg 1 if flg==0:
    ans+=1 flg==0 flg 0 ans+=1 ans 1 print(ans) print ans t=list(map(int,input().split())) list(map(int,input().split())) t a=[] [] a ans+=1 1 ans ans=0 0 ans b=list(map(int,input().split())) list(map(int,input().split())) b m=map(int,input().split()) map(int,input().split()) m n,m=map(int,input().split()) map(int,input().split()) n c=[0]*m [0]*m c flg=1 1 flg flg=0 0 flg
n,m=map(int,input().split())
a=[]
ans=0
for _ in range(m):
  t=list(map(int,input().split()))
  t.pop(0)
  a.append(t)
b=list(map(int,input().split()))
for i in range(2**n):
  c=[0]*m
  for j in range(n):
     if ((i>>j) & 1):
        for k in range(len(a)):
          if (j+1) in a[k]:
            c[k]+=1
  flg=0
  for j in range(m):
    if c[j]%2!=b[j]:
      flg=1
  if flg==0:
    ans+=1
print(ans)