n, m = map(int,input().split())
s_list = []
p_list = []

for i in range(m):
    tmp = []
    tmp = list(map(int,input().split()))
    s_list.append(tmp)

p_list = list(map(int,input().split()))

ans = 0

for i in range((2**n)):
    bin_i = [int(x) for x in bin(i)[2:]]
    while len(bin_i) != n:
        bin_i.insert(0,0)
    flag = 0
    for j in range(m):
        tmp = 0
        for k in range(1,s_list[j][0]+1):
            tmp += bin_i[s_list[j][k]-1]
        if tmp%2 != p_list[j]:
            flag = 1
            break
    if flag == 0:
        ans += 1

print(ans) n, m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m s_list = [] s_list [] p_list = [] p_list [] for i in range(m):
    tmp = []
    tmp = list(map(int,input().split()))
    s_list.append(tmp) i range(m) range m tmp = [] tmp [] tmp = list(map(int,input().split())) tmp list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split s_list.append(tmp) s_list.append s_list append tmp p_list = list(map(int,input().split())) p_list list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ans = 0 ans 0 for i in range((2**n)):
    bin_i = [int(x) for x in bin(i)[2:]]
    while len(bin_i) != n:
        bin_i.insert(0,0)
    flag = 0
    for j in range(m):
        tmp = 0
        for k in range(1,s_list[j][0]+1):
            tmp += bin_i[s_list[j][k]-1]
        if tmp%2 != p_list[j]:
            flag = 1
            break
    if flag == 0:
        ans += 1 i range((2**n)) range 2**n 2 n int(x) for x in bin(i)[2:] for x in bin(i)[2:] x bin(i)[2:] (i) bin i 2: 2 for x in bin(i)[2:] int(x) int x bin_i = [int(x) for x in bin(i)[2:]] bin_i [int(x) for x in bin(i)[2:]] while len(bin_i) != n:
        bin_i.insert(0,0)
     len(bin_i) != n len(bin_i) len bin_i n bin_i.insert(0,0) bin_i.insert bin_i insert 0 0 flag = 0 flag 0 for j in range(m):
        tmp = 0
        for k in range(1,s_list[j][0]+1):
            tmp += bin_i[s_list[j][k]-1]
        if tmp%2 != p_list[j]:
            flag = 1
            break
     j range(m) range m tmp = 0 tmp 0 for k in range(1,s_list[j][0]+1):
            tmp += bin_i[s_list[j][k]-1]
         k range(1,s_list[j][0]+1) range 1 s_list[j][0]+1 s_list[j][0] [j] s_list j 0 1 tmp += bin_i[s_list[j][k]-1] tmp bin_i[s_list[j][k]-1] bin_i s_list[j][k]-1 s_list[j][k] [j] s_list j k 1 if tmp%2 != p_list[j]:
            flag = 1
            break
     tmp%2 != p_list[j] tmp%2 tmp 2 p_list[j] p_list j flag = 1 flag 1 break if flag == 0:
        ans += 1 flag == 0 flag 0 ans += 1 ans 1 print(ans) print ans tmp = [] [] tmp tmp = list(map(int,input().split())) list(map(int,input().split())) tmp p_list = list(map(int,input().split())) list(map(int,input().split())) p_list m = map(int,input().split()) map(int,input().split()) m ans += 1 1 ans p_list = [] [] p_list tmp += bin_i[s_list[j][k]-1] bin_i[s_list[j][k]-1] tmp flag = 0 0 flag flag = 1 1 flag s_list = [] [] s_list tmp = 0 0 tmp bin_i = [int(x) for x in bin(i)[2:]] [int(x) for x in bin(i)[2:]] bin_i ans = 0 0 ans n, m = map(int,input().split()) map(int,input().split()) n
n, m = map(int,input().split())
s_list = []
p_list = []

for i in range(m):
    tmp = []
    tmp = list(map(int,input().split()))
    s_list.append(tmp)

p_list = list(map(int,input().split()))

ans = 0

for i in range((2**n)):
    bin_i = [int(x) for x in bin(i)[2:]]
    while len(bin_i) != n:
        bin_i.insert(0,0)
    flag = 0
    for j in range(m):
        tmp = 0
        for k in range(1,s_list[j][0]+1):
            tmp += bin_i[s_list[j][k]-1]
        if tmp%2 != p_list[j]:
            flag = 1
            break
    if flag == 0:
        ans += 1

print(ans)
