#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc128_c

N, M = map(int, input().strip().split())
k = [[] for _ in range(M)]
for i in range(M):
    switches = list(map(int, input().strip().split()))
    k[i] = switches[1:]
p = list(map(int, input().strip().split()))

res = 0
for i in range(2**N):
    b = format(i, '0' + str(N) + 'b')
    can_light_up = True
    for j in range(M):
        count = 0
        for s in k[j]:
            if b[s-1] == '1':
                count += 1
        if count % 2 != p[j]:
            can_light_up = False
    if can_light_up:
        res += 1

print(res) N, M = map(int, input().strip().split()) N map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split M [] for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) [] k = [[] for _ in range(M)] k [[] for _ in range(M)] for i in range(M):
    switches = list(map(int, input().strip().split()))
    k[i] = switches[1:] i range(M) range M switches = list(map(int, input().strip().split())) switches list(map(int, input().strip().split())) list map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split k[i] = switches[1:] k[i] k i switches[1:] switches 1: 1 p = list(map(int, input().strip().split())) p list(map(int, input().strip().split())) list map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split res = 0 res 0 for i in range(2**N):
    b = format(i, '0' + str(N) + 'b')
    can_light_up = True
    for j in range(M):
        count = 0
        for s in k[j]:
            if b[s-1] == '1':
                count += 1
        if count % 2 != p[j]:
            can_light_up = False
    if can_light_up:
        res += 1 i range(2**N) range 2**N 2 N b = format(i, '0' + str(N) + 'b') b format(i, '0' + str(N) + 'b') format i '0' + str(N) + 'b' '0' + str(N) '0' str(N) str N 'b' can_light_up = True can_light_up True for j in range(M):
        count = 0
        for s in k[j]:
            if b[s-1] == '1':
                count += 1
        if count % 2 != p[j]:
            can_light_up = False
     j range(M) range M count = 0 count 0 for s in k[j]:
            if b[s-1] == '1':
                count += 1
         s k[j] k j if b[s-1] == '1':
                count += 1
         b[s-1] == '1' b[s-1] b s-1 s 1 '1' count += 1 count 1 if count % 2 != p[j]:
            can_light_up = False
     count % 2 != p[j] count % 2 count 2 p[j] p j can_light_up = False can_light_up False if can_light_up:
        res += 1 can_light_up res += 1 res 1 print(res) print res count = 0 0 count switches = list(map(int, input().strip().split())) list(map(int, input().strip().split())) switches p = list(map(int, input().strip().split())) list(map(int, input().strip().split())) p can_light_up = False False can_light_up res = 0 0 res res += 1 1 res can_light_up = True True can_light_up b = format(i, '0' + str(N) + 'b') format(i, '0' + str(N) + 'b') b count += 1 1 count N, M = map(int, input().strip().split()) map(int, input().strip().split()) N M = map(int, input().strip().split()) map(int, input().strip().split()) M k = [[] for _ in range(M)] [[] for _ in range(M)] k
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# 問題：https://atcoder.jp/contests/abc126/tasks/abc128_c

N, M = map(int, input().strip().split())
k = [[] for _ in range(M)]
for i in range(M):
    switches = list(map(int, input().strip().split()))
    k[i] = switches[1:]
p = list(map(int, input().strip().split()))

res = 0
for i in range(2**N):
    b = format(i, '0' + str(N) + 'b')
    can_light_up = True
    for j in range(M):
        count = 0
        for s in k[j]:
            if b[s-1] == '1':
                count += 1
        if count % 2 != p[j]:
            can_light_up = False
    if can_light_up:
        res += 1

print(res)
