n, m = map(int,input().split())
k, s = [], []
for i in range(m):
  inp = list(map(int, input().split()))
  k_, s_ = inp[0], inp[1:]
  k.append(k_)
  s.append(s_)
p = list(map(int, input().split()))
ans = 0
for bit in range(1<<n):
  flg = True
  for i in range(m):
    cnt = 0
    for e in s[i]:
      e -= 1
      if bit & 1<<e: cnt += 1
    if cnt%2 != p[i]: flg = False
  if flg: ans += 1
print(ans) n, m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m k, s = [], [] k [] s [] for i in range(m):
  inp = list(map(int, input().split()))
  k_, s_ = inp[0], inp[1:]
  k.append(k_)
  s.append(s_) i range(m) range m inp = list(map(int, input().split())) inp list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split k_, s_ = inp[0], inp[1:] k_ inp[0] inp 0 s_ inp[1:] inp 1: 1 k.append(k_) k.append k append k_ s.append(s_) s.append s append s_ 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 bit in range(1<<n):
  flg = True
  for i in range(m):
    cnt = 0
    for e in s[i]:
      e -= 1
      if bit & 1<<e: cnt += 1
    if cnt%2 != p[i]: flg = False
  if flg: ans += 1 bit range(1<<n) range 1<<n 1 n flg = True flg True for i in range(m):
    cnt = 0
    for e in s[i]:
      e -= 1
      if bit & 1<<e: cnt += 1
    if cnt%2 != p[i]: flg = False
   i range(m) range m cnt = 0 cnt 0 for e in s[i]:
      e -= 1
      if bit & 1<<e: cnt += 1
     e s[i] s i e -= 1 e 1 if bit & 1<<e: cnt += 1
     bit & 1<<e bit 1<<e 1 e if cnt%2 != p[i]: flg = False
   cnt%2 != p[i] cnt%2 cnt 2 p[i] p i if flg: ans += flg print(ans) print ans p = list(map(int, input().split())) list(map(int, input().split())) p k, s = [], [] [] k n, m = map(int,input().split()) map(int,input().split()) n inp = list(map(int, input().split())) list(map(int, input().split())) inp ans = 0 0 ans s = [], [] [] s cnt = 0 0 cnt k_, s_ = inp[0], inp[1:] inp[0] k_ m = map(int,input().split()) map(int,input().split()) m s_ = inp[0], inp[1:] inp[1:] s_ flg = True True flg e -= 1 1 e
n, m = map(int,input().split())
k, s = [], []
for i in range(m):
  inp = list(map(int, input().split()))
  k_, s_ = inp[0], inp[1:]
  k.append(k_)
  s.append(s_)
p = list(map(int, input().split()))
ans = 0
for bit in range(1<<n):
  flg = True
  for i in range(m):
    cnt = 0
    for e in s[i]:
      e -= 1
      if bit & 1<<e: cnt += 1
    if cnt%2 != p[i]: flg = False
  if flg: ans += 1
print(ans)