N, M = map(int, input().split())
ks = []
for _ in range(M):
    ks.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0
for bit in range(2**N):
    on_list = []
    for i in range(N):
        if bit & (1 << i):
            on_list.append(i+1)
    flag = True
    for s, p_ in zip(ks, p):
        on_sum = len(list(set(on_list) & set(s[1:])))
        if on_sum % 2 != p_:
            flag = False
            break
    
    if flag:
        ans += 1
        
print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M ks = [] ks [] for _ in range(M):
    ks.append(list(map(int, input().split()))) _ range(M) range M ks.append(list(map(int, input().split()))) ks.append ks append list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 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(2**N):
    on_list = []
    for i in range(N):
        if bit & (1 << i):
            on_list.append(i+1)
    flag = True
    for s, p_ in zip(ks, p):
        on_sum = len(list(set(on_list) & set(s[1:])))
        if on_sum % 2 != p_:
            flag = False
            break
    
    if flag:
        ans += 1
         bit range(2**N) range 2**N 2 N on_list = [] on_list [] for i in range(N):
        if bit & (1 << i):
            on_list.append(i+1)
     i range(N) range N if bit & (1 << i):
            on_list.append(i+1)
     bit & (1 << i) bit 1 << i 1 i on_list.append(i+1) on_list.append on_list append i+1 i 1 flag = True flag True for s, p_ in zip(ks, p):
        on_sum = len(list(set(on_list) & set(s[1:])))
        if on_sum % 2 != p_:
            flag = False
            break
    
     s p_ zip(ks, p) zip ks p on_sum = len(list(set(on_list) & set(s[1:]))) on_sum len(list(set(on_list) & set(s[1:]))) len list(set(on_list) & set(s[1:])) list set(on_list) & set(s[1:]) set(on_list) set on_list set(s[1:]) set s[1:] s 1: 1 if on_sum % 2 != p_:
            flag = False
            break
    
     on_sum % 2 != p_ on_sum % 2 on_sum 2 p_ flag = False flag False break if flag:
        ans += 1
         flag ans += 1 ans 1 print(ans) print ans p = list(map(int, input().split())) list(map(int, input().split())) p flag = False False flag ans += 1 1 ans N, M = map(int, input().split()) map(int, input().split()) N on_list = [] [] on_list flag = True True flag M = map(int, input().split()) map(int, input().split()) M ks = [] [] ks ans = 0 0 ans on_sum = len(list(set(on_list) & set(s[1:]))) len(list(set(on_list) & set(s[1:]))) on_sum
N, M = map(int, input().split())
ks = []
for _ in range(M):
    ks.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0
for bit in range(2**N):
    on_list = []
    for i in range(N):
        if bit & (1 << i):
            on_list.append(i+1)
    flag = True
    for s, p_ in zip(ks, p):
        on_sum = len(list(set(on_list) & set(s[1:])))
        if on_sum % 2 != p_:
            flag = False
            break
    
    if flag:
        ans += 1
        
print(ans)