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 i in range(2**n):
    bnt = 0
    for j in range(m):
        cnt = 0
        for l in range(1, len(ks[j])):
            if (i>>(ks[j][l]-1))&1 == 1:
                cnt += 1
        if cnt%2 == p[j]:
            bnt += 1
    if bnt == 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 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 i in range(2**n):
    bnt = 0
    for j in range(m):
        cnt = 0
        for l in range(1, len(ks[j])):
            if (i>>(ks[j][l]-1))&1 == 1:
                cnt += 1
        if cnt%2 == p[j]:
            bnt += 1
    if bnt == m:
        ans += 1 i range(2**n) range 2**n 2 n bnt = 0 bnt 0 for j in range(m):
        cnt = 0
        for l in range(1, len(ks[j])):
            if (i>>(ks[j][l]-1))&1 == 1:
                cnt += 1
        if cnt%2 == p[j]:
            bnt += 1
     j range(m) range m cnt = 0 cnt 0 for l in range(1, len(ks[j])):
            if (i>>(ks[j][l]-1))&1 == 1:
                cnt += 1
         l range(1, len(ks[j])) range 1 len(ks[j]) len ks[j] ks j if (i>>(ks[j][l]-1))&1 == 1:
                cnt += 1
         (i>>(ks[j][l]-1))&1 == 1 (i>>(ks[j][l]-1))&1 i>>(ks[j][l]-1) i ks[j][l]-1 ks[j][l] [j] ks j l 1 1 1 cnt += 1 cnt 1 if cnt%2 == p[j]:
            bnt += 1
     cnt%2 == p[j] cnt%2 cnt 2 p[j] p j bnt += 1 bnt 1 if bnt == m:
        ans += 1 bnt == m bnt m ans += 1 ans 1 print(ans) print ans m = map(int, input().split()) map(int, input().split()) m ks = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] ks p = list(map(int, input().split())) list(map(int, input().split())) p bnt += 1 1 bnt bnt = 0 0 bnt cnt += 1 1 cnt n, m = map(int, input().split()) map(int, input().split()) n ans = 0 0 ans ans += 1 1 ans cnt = 0 0 cnt
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 i in range(2**n):
    bnt = 0
    for j in range(m):
        cnt = 0
        for l in range(1, len(ks[j])):
            if (i>>(ks[j][l]-1))&1 == 1:
                cnt += 1
        if cnt%2 == p[j]:
            bnt += 1
    if bnt == m:
        ans += 1
print(ans)