N,M = map(int,input().split())
k = [list(map(int,input().split()))for _ in range(M)]
p = list(map(int,input().split()))
ans = 0
for S in range(1 << N):
    res = [pp==0 for pp in p]
    for j in range(N):
        if (S >> j) & 1:
            for l in range(M):
                if j+1 in k[l][1:]:
                    res[l] = not res[l]
    if res == [True] * M:
        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 k = [list(map(int,input().split()))for _ in range(M)] k [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 S in range(1 << N):
    res = [pp==0 for pp in p]
    for j in range(N):
        if (S >> j) & 1:
            for l in range(M):
                if j+1 in k[l][1:]:
                    res[l] = not res[l]
    if res == [True] * M:
        ans += 1 S range(1 << N) range 1 << N 1 N pp==0 for pp in p for pp in p pp p for pp in p pp==0 pp 0 res = [pp==0 for pp in p] res [pp==0 for pp in p] for j in range(N):
        if (S >> j) & 1:
            for l in range(M):
                if j+1 in k[l][1:]:
                    res[l] = not res[l]
     j range(N) range N if (S >> j) & 1:
            for l in range(M):
                if j+1 in k[l][1:]:
                    res[l] = not res[l]
     (S >> j) & 1 S >> j S j 1 for l in range(M):
                if j+1 in k[l][1:]:
                    res[l] = not res[l]
     l range(M) range M if j+1 in k[l][1:]:
                    res[l] = not res[l]
     j+1 in k[l][1:] j+1 j 1 k[l][1:] [l] k l 1: 1 res[l] = not res[l] res[l] res l not res[l] res[l] res l if res == [True] * M:
        ans += 1 res == [True] * M res [True] * M [True] True M ans += 1 ans 1 print(ans) print ans ans = 0 0 ans ans += 1 1 ans N,M = map(int,input().split()) map(int,input().split()) N M = map(int,input().split()) map(int,input().split()) M res = [pp==0 for pp in p] [pp==0 for pp in p] res p = list(map(int,input().split())) list(map(int,input().split())) p k = [list(map(int,input().split()))for _ in range(M)] [list(map(int,input().split()))for _ in range(M)] k
N,M = map(int,input().split())
k = [list(map(int,input().split()))for _ in range(M)]
p = list(map(int,input().split()))
ans = 0
for S in range(1 << N):
    res = [pp==0 for pp in p]
    for j in range(N):
        if (S >> j) & 1:
            for l in range(M):
                if j+1 in k[l][1:]:
                    res[l] = not res[l]
    if res == [True] * M:
        ans += 1
print(ans)
