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

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

ans = 0
for ii in range(2**N):
    check = True
    for i in range(M):
        cnt = 0
        for j in range(1, len(ks[i])):
            if (ii >> (ks[i][j]-1)) & 1:
                cnt += 1
        if cnt % 2 != p[i]:
            check = False
            break
    if check:
        ans += 1
print(ans)