N, M = map(int, input().split())
connected = [list(map(int,input().split())) for _ in range(M)]
p = list(map(int, input().split()))
ans = 0

for i in range(1<<N):
    for j,lst in enumerate(connected):
        count = 0
        for s in lst[1:]:
            if (i>>(s-1)) & 1:
                count += 1
        if count % 2 != p[j]:
            break
    else:
        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())) for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split connected = [list(map(int,input().split())) for _ in range(M)] connected [list(map(int,input().split())) 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):
    for j,lst in enumerate(connected):
        count = 0
        for s in lst[1:]:
            if (i>>(s-1)) & 1:
                count += 1
        if count % 2 != p[j]:
            break
    else:
        ans += 1 i range(1<<N) range 1<<N 1 N for j,lst in enumerate(connected):
        count = 0
        for s in lst[1:]:
            if (i>>(s-1)) & 1:
                count += 1
        if count % 2 != p[j]:
            break
    else:
        ans += 1 j lst enumerate(connected) enumerate connected count = 0 count 0 for s in lst[1:]:
            if (i>>(s-1)) & 1:
                count += 1
         s lst[1:] lst 1: 1 if (i>>(s-1)) & 1:
                count += 1
         (i>>(s-1)) & 1 i>>(s-1) i s-1 s 1 1 count += 1 count 1 if count % 2 != p[j]:
            break
     count % 2 != p[j] count % 2 count 2 p[j] p j break ans += 1 ans 1 print(ans) print ans ans = 0 0 ans count = 0 0 count p = list(map(int, input().split())) list(map(int, input().split())) p connected = [list(map(int,input().split())) for _ in range(M)] [list(map(int,input().split())) for _ in range(M)] connected ans += 1 1 ans count += 1 1 count 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())
connected = [list(map(int,input().split())) for _ in range(M)]
p = list(map(int, input().split()))
ans = 0

for i in range(1<<N):
    for j,lst in enumerate(connected):
        count = 0
        for s in lst[1:]:
            if (i>>(s-1)) & 1:
                count += 1
        if count % 2 != p[j]:
            break
    else:
        ans += 1

print(ans)
