N, M = map(int, input().split())
lamp = [0] * M 
for j in range(M):
    s = ['0'] * N 
    k, *num = map(int, input().split())    #; print(k, num)
    for x in num:
        s[x-1] ='1'
    lamp[j] = int(''.join(s[::-1]), 2)     #; print(bin(lamp[j]))

p = [int(i) for i in input().split()] 
ans = 0
for i in range(2**N):
    for j in range(M):
        if bin(i&lamp[j]).count('1') % 2 != p[j]:
            break
    else:
        ans += 1
print(ans)         N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M lamp = [0] * M lamp [0] * M [0] 0 M for j in range(M):
    s = ['0'] * N 
    k, *num = map(int, input().split())    #; print(k, num)
    for x in num:
        s[x-1] ='1'
    lamp[j] = int(''.join(s[::-1]), 2)     #; print(bin(lamp[j])) j range(M) range M s = ['0'] * N s ['0'] * N ['0'] '0' N k, *num = map(int, input().split()) k map(int, input().split()) map int input().split() ().split () input split *num num for x in num:
        s[x-1] ='1'
     x num s[x-1] ='1' s[x-1] s x-1 x 1 '1' lamp[j] = int(''.join(s[::-1]), 2) lamp[j] lamp j int(''.join(s[::-1]), 2) int ''.join(s[::-1]) ''.join '' join s[::-1] s ::-1 -1 2 int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i p = [int(i) for i in input().split()] p [int(i) for i in input().split()] ans = 0 ans 0 for i in range(2**N):
    for j in range(M):
        if bin(i&lamp[j]).count('1') % 2 != p[j]:
            break
    else:
        ans += 1 i range(2**N) range 2**N 2 N for j in range(M):
        if bin(i&lamp[j]).count('1') % 2 != p[j]:
            break
    else:
        ans += 1 j range(M) range M if bin(i&lamp[j]).count('1') % 2 != p[j]:
            break
     bin(i&lamp[j]).count('1') % 2 != p[j] bin(i&lamp[j]).count('1') % 2 bin(i&lamp[j]).count('1') (i&lamp[j]).count (i&lamp[j]) bin i&lamp[j] i lamp[j] lamp j count '1' 2 p[j] p j break ans += 1 ans 1 print(ans) print ans N, M = map(int, input().split()) map(int, input().split()) N s = ['0'] * N ['0'] * N s p = [int(i) for i in input().split()] [int(i) for i in input().split()] p M = map(int, input().split()) map(int, input().split()) M k, *num = map(int, input().split()) map(int, input().split()) k ans = 0 0 ans lamp = [0] * M [0] * M lamp ans += 1 1 ans
N, M = map(int, input().split())
lamp = [0] * M 
for j in range(M):
    s = ['0'] * N 
    k, *num = map(int, input().split())    #; print(k, num)
    for x in num:
        s[x-1] ='1'
    lamp[j] = int(''.join(s[::-1]), 2)     #; print(bin(lamp[j]))

p = [int(i) for i in input().split()] 
ans = 0
for i in range(2**N):
    for j in range(M):
        if bin(i&lamp[j]).count('1') % 2 != p[j]:
            break
    else:
        ans += 1
print(ans)        
