n,m = map(int,input().split())
A = []
ans = 0
for _ in range(m):
    A.append(list(map(int,input().split())))
P = list(map(int,input().split()))
for bit in range(1<<n):
    flag = True
    for i in range(m):
        cnt = 0
        k,S = A[i][0],A[i][1:]
        for s in S:
            if ((bit>>(s-1))&1) and flag == True:
                cnt += 1
        if cnt %2==P[i]:
            continue
        else:
            flag = False
    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 A = [] A [] ans = 0 ans 0 for _ in range(m):
    A.append(list(map(int,input().split()))) _ range(m) range m A.append(list(map(int,input().split()))) A.append A 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 for bit in range(1<<n):
    flag = True
    for i in range(m):
        cnt = 0
        k,S = A[i][0],A[i][1:]
        for s in S:
            if ((bit>>(s-1))&1) and flag == True:
                cnt += 1
        if cnt %2==P[i]:
            continue
        else:
            flag = False
    if flag:
        ans += 1 bit range(1<<n) range 1<<n 1 n flag = True flag True for i in range(m):
        cnt = 0
        k,S = A[i][0],A[i][1:]
        for s in S:
            if ((bit>>(s-1))&1) and flag == True:
                cnt += 1
        if cnt %2==P[i]:
            continue
        else:
            flag = False
     i range(m) range m cnt = 0 cnt 0 k,S = A[i][0],A[i][1:] k A[i][0] [i] A i 0 S A[i][1:] [i] A i 1: 1 for s in S:
            if ((bit>>(s-1))&1) and flag == True:
                cnt += 1
         s S if ((bit>>(s-1))&1) and flag == True:
                cnt += 1
         ((bit>>(s-1))&1) and flag == True (bit>>(s-1))&1 bit>>(s-1) bit s-1 s 1 1 flag == True flag True cnt += 1 cnt 1 if cnt %2==P[i]:
            continue
        else:
            flag = False
     cnt %2==P[i] cnt %2 cnt 2 P[i] P i continue flag = False flag False if flag:
        ans += 1 flag ans += 1 ans 1 print(ans) print ans ans = 0 0 ans k,S = A[i][0],A[i][1:] A[i][0] k cnt += 1 1 cnt m = map(int,input().split()) map(int,input().split()) m P = list(map(int,input().split())) list(map(int,input().split())) P n,m = map(int,input().split()) map(int,input().split()) n A = [] [] A cnt = 0 0 cnt flag = True True flag flag = False False flag ans += 1 1 ans S = A[i][0],A[i][1:] A[i][1:] S
n,m = map(int,input().split())
A = []
ans = 0
for _ in range(m):
    A.append(list(map(int,input().split())))
P = list(map(int,input().split()))
for bit in range(1<<n):
    flag = True
    for i in range(m):
        cnt = 0
        k,S = A[i][0],A[i][1:]
        for s in S:
            if ((bit>>(s-1))&1) and flag == True:
                cnt += 1
        if cnt %2==P[i]:
            continue
        else:
            flag = False
    if flag:
        ans += 1
print(ans)

