n, m = map(int, input().split())

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

ans = 0
for i in range(1 << n):
    tmp = 0
    for j in range(m):
        on = 0
        for k in range(1, s[j][0]+1):
            if i & (1 << s[j][k]-1):
                on += 1
        if p[j] % 2 == on % 2:
            tmp += 1
    if tmp == 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 s = [list(map(int, input().split())) for _ in range(m)] s [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):
    tmp = 0
    for j in range(m):
        on = 0
        for k in range(1, s[j][0]+1):
            if i & (1 << s[j][k]-1):
                on += 1
        if p[j] % 2 == on % 2:
            tmp += 1
    if tmp == m:
        ans += 1 i range(1 << n) range 1 << n 1 n tmp = 0 tmp 0 for j in range(m):
        on = 0
        for k in range(1, s[j][0]+1):
            if i & (1 << s[j][k]-1):
                on += 1
        if p[j] % 2 == on % 2:
            tmp += 1
     j range(m) range m on = 0 on 0 for k in range(1, s[j][0]+1):
            if i & (1 << s[j][k]-1):
                on += 1
         k range(1, s[j][0]+1) range 1 s[j][0]+1 s[j][0] [j] s j 0 1 if i & (1 << s[j][k]-1):
                on += 1
         i & (1 << s[j][k]-1) i 1 << s[j][k]-1 1 s[j][k]-1 s[j][k] [j] s j k 1 on += 1 on 1 if p[j] % 2 == on % 2:
            tmp += 1
     p[j] % 2 == on % 2 p[j] % 2 p[j] p j 2 on % 2 on 2 tmp += 1 tmp 1 if tmp == m:
        ans += 1 tmp == m tmp m ans += 1 ans 1 print(ans) print ans ans += 1 1 ans tmp = 0 0 tmp n, m = map(int, input().split()) map(int, input().split()) n tmp += 1 1 tmp on = 0 0 on p = list(map(int, input().split())) list(map(int, input().split())) p ans = 0 0 ans on += 1 1 on m = map(int, input().split()) map(int, input().split()) m s = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] s
n, m = map(int, input().split())

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

ans = 0
for i in range(1 << n):
    tmp = 0
    for j in range(m):
        on = 0
        for k in range(1, s[j][0]+1):
            if i & (1 << s[j][k]-1):
                on += 1
        if p[j] % 2 == on % 2:
            tmp += 1
    if tmp == m:
        ans += 1

print(ans)
