n, m = map(int, input().split())
s = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))

ans = 0
for i in range(2**n): #スイッチの状態
    cnt = 0
    for j in range(m): #電球の状態
        s_on = 0
        for k in range(s[j][0]):
            s_on += (i >> (s[j][k+1]-1) & 1)
        if s_on % 2 == p[j]:
            cnt += 1
    if cnt == 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 i in range(m) for i in range(m) i range(m) range m for i in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split s = [list(map(int, input().split())) for i in range(m)] s [list(map(int, input().split())) for i 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): #スイッチの状態
    cnt = 0
    for j in range(m): #電球の状態
        s_on = 0
        for k in range(s[j][0]):
            s_on += (i >> (s[j][k+1]-1) & 1)
        if s_on % 2 == p[j]:
            cnt += 1
    if cnt == m:
        ans += 1 i range(2**n) range 2**n 2 n cnt = 0 cnt 0 for j in range(m): #電球の状態
        s_on = 0
        for k in range(s[j][0]):
            s_on += (i >> (s[j][k+1]-1) & 1)
        if s_on % 2 == p[j]:
            cnt += 1
     j range(m) range m s_on = 0 s_on 0 for k in range(s[j][0]):
            s_on += (i >> (s[j][k+1]-1) & 1)
         k range(s[j][0]) range s[j][0] [j] s j 0 s_on += (i >> (s[j][k+1]-1) & 1) s_on i >> (s[j][k+1]-1) & 1 i >> (s[j][k+1]-1) i s[j][k+1]-1 s[j][k+1] [j] s j k+1 k 1 1 1 if s_on % 2 == p[j]:
            cnt += 1
     s_on % 2 == p[j] s_on % 2 s_on 2 p[j] p j cnt += 1 cnt 1 if cnt == m:
        ans += 1 cnt == m cnt m ans += 1 ans 1 print(ans) print ans cnt = 0 0 cnt s = [list(map(int, input().split())) for i in range(m)] [list(map(int, input().split())) for i in range(m)] s p = list(map(int, input().split())) list(map(int, input().split())) p s_on += (i >> (s[j][k+1]-1) & 1) i >> (s[j][k+1]-1) & 1 s_on m = map(int, input().split()) map(int, input().split()) m ans = 0 0 ans n, m = map(int, input().split()) map(int, input().split()) n cnt += 1 1 cnt ans += 1 1 ans s_on = 0 0 s_on
n, m = map(int, input().split())
s = [list(map(int, input().split())) for i in range(m)]
p = list(map(int, input().split()))

ans = 0
for i in range(2**n): #スイッチの状態
    cnt = 0
    for j in range(m): #電球の状態
        s_on = 0
        for k in range(s[j][0]):
            s_on += (i >> (s[j][k+1]-1) & 1)
        if s_on % 2 == p[j]:
            cnt += 1
    if cnt == m:
        ans += 1

print(ans)