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

ans = 0
for x in range(2**n):
  for i in range(m):
    cnt = 0
    for j in range(n):
      if (x >> j & 1) and s[i][j]:
        cnt += 1
    if cnt % 2 != p[i]:
      break
  else:  # breakしなかった=すべて一致した場合のみ
    ans += 1
print(ans) n,m=map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m k=[0]*m k [0]*m [0] 0 m [0 for j in range(n)] for i in range(m) for i in range(m) i range(m) range m for i in range(m) [0 for j in range(n)] s=[[0 for j in range(n)] for i in range(m)] s [[0 for j in range(n)] for i in range(m)] for i in range(m):
  x = list(map(int,input().split()))
  k = x[0]
  for j in range(1, k+1):
    s[i][x[j]-1] = 1 i range(m) range m x = list(map(int,input().split())) x list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split k = x[0] k x[0] x 0 for j in range(1, k+1):
    s[i][x[j]-1] = 1 j range(1, k+1) range 1 k+1 k 1 s[i][x[j]-1] = 1 s[i][x[j]-1] [i] s i x[j]-1 x[j] x 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 for x in range(2**n):
  for i in range(m):
    cnt = 0
    for j in range(n):
      if (x >> j & 1) and s[i][j]:
        cnt += 1
    if cnt % 2 != p[i]:
      break
  else:  # breakしなかった=すべて一致した場合のみ
    ans += 1 x range(2**n) range 2**n 2 n for i in range(m):
    cnt = 0
    for j in range(n):
      if (x >> j & 1) and s[i][j]:
        cnt += 1
    if cnt % 2 != p[i]:
      break
  else:  # breakしなかった=すべて一致した場合のみ
    ans += 1 i range(m) range m cnt = 0 cnt 0 for j in range(n):
      if (x >> j & 1) and s[i][j]:
        cnt += 1
     j range(n) range n if (x >> j & 1) and s[i][j]:
        cnt += 1
     (x >> j & 1) and s[i][j] x >> j & 1 x >> j x j 1 s[i][j] [i] s i j cnt += 1 cnt 1 if cnt % 2 != p[i]:
      break
   cnt % 2 != p[i] cnt % 2 cnt 2 p[i] p i break ans += 1 ans 1 print(ans) print ans s=[[0 for j in range(n)] for i in range(m)] [[0 for j in range(n)] for i in range(m)] s ans += 1 1 ans x = list(map(int,input().split())) list(map(int,input().split())) x p=list(map(int,input().split())) list(map(int,input().split())) p k = x[0] x[0] k cnt = 0 0 cnt n,m=map(int,input().split()) map(int,input().split()) n k=[0]*m [0]*m k ans = 0 0 ans cnt += 1 1 cnt m=map(int,input().split()) map(int,input().split()) m
n,m=map(int,input().split())
k=[0]*m
s=[[0 for j in range(n)] for i in range(m)]
for i in range(m):
  x = list(map(int,input().split()))
  k = x[0]
  for j in range(1, k+1):
    s[i][x[j]-1] = 1
p=list(map(int,input().split()))

ans = 0
for x in range(2**n):
  for i in range(m):
    cnt = 0
    for j in range(n):
      if (x >> j & 1) and s[i][j]:
        cnt += 1
    if cnt % 2 != p[i]:
      break
  else:  # breakしなかった=すべて一致した場合のみ
    ans += 1
print(ans)