N, M = map(int, input().split())
S = [list(map(int, input().split()))[1:] for _ in range(M)]
P = list(map(int, input().split()))
ans = 0
for i in range(1<<N):
    ok = True
    for j in range(M):
        cnt = 0
        for s in S[j]:
            if i&(1<<(s-1)):
                cnt += 1
        if cnt%2 != P[j]:
            ok = False
            break
    if ok:
        ans += 1
print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M list(map(int, input().split()))[1:] for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) list(map(int, input().split()))[1:] (map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split 1: 1 S = [list(map(int, input().split()))[1:] for _ in range(M)] S [list(map(int, input().split()))[1:] for _ in range(M)] 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 i in range(1<<N):
    ok = True
    for j in range(M):
        cnt = 0
        for s in S[j]:
            if i&(1<<(s-1)):
                cnt += 1
        if cnt%2 != P[j]:
            ok = False
            break
    if ok:
        ans += 1 i range(1<<N) range 1<<N 1 N ok = True ok True for j in range(M):
        cnt = 0
        for s in S[j]:
            if i&(1<<(s-1)):
                cnt += 1
        if cnt%2 != P[j]:
            ok = False
            break
     j range(M) range M cnt = 0 cnt 0 for s in S[j]:
            if i&(1<<(s-1)):
                cnt += 1
         s S[j] S j if i&(1<<(s-1)):
                cnt += 1
         i&(1<<(s-1)) i 1<<(s-1) 1 s-1 s 1 cnt += 1 cnt 1 if cnt%2 != P[j]:
            ok = False
            break
     cnt%2 != P[j] cnt%2 cnt 2 P[j] P j ok = False ok False break if ok:
        ans += 1 ok ans += 1 ans 1 print(ans) print ans ans += 1 1 ans ok = False False ok S = [list(map(int, input().split()))[1:] for _ in range(M)] [list(map(int, input().split()))[1:] for _ in range(M)] S ok = True True ok P = list(map(int, input().split())) list(map(int, input().split())) P ans = 0 0 ans cnt = 0 0 cnt cnt += 1 1 cnt N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M
N, M = map(int, input().split())
S = [list(map(int, input().split()))[1:] for _ in range(M)]
P = list(map(int, input().split()))
ans = 0
for i in range(1<<N):
    ok = True
    for j in range(M):
        cnt = 0
        for s in S[j]:
            if i&(1<<(s-1)):
                cnt += 1
        if cnt%2 != P[j]:
            ok = False
            break
    if ok:
        ans += 1
print(ans)
