n, m = map(int, input().split())
switch = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)]
rest = list(map(int, input().split()))
ans = 0
for bit in range(1<<n):
    for j in range(m):
        on_sum = 0
        for i in range(n):
            if bit >> i & 1 and i in switch[j]:
                on_sum += 1
        if on_sum % 2 != rest[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 list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(lambda x:int(x)-1, input().split()))[1:] (map(lambda x:int(x)-1, input().split())) list map(lambda x:int(x)-1, input().split()) map lambda x:int(x)-1 int(x)-1 int(x) int x 1 x input().split() ().split () input split 1: 1 switch = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)] switch [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)] rest = list(map(int, input().split())) rest list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for bit in range(1<<n):
    for j in range(m):
        on_sum = 0
        for i in range(n):
            if bit >> i & 1 and i in switch[j]:
                on_sum += 1
        if on_sum % 2 != rest[j]:
            break
    else :
        ans += 1 bit range(1<<n) range 1<<n 1 n for j in range(m):
        on_sum = 0
        for i in range(n):
            if bit >> i & 1 and i in switch[j]:
                on_sum += 1
        if on_sum % 2 != rest[j]:
            break
    else :
        ans += 1 j range(m) range m on_sum = 0 on_sum 0 for i in range(n):
            if bit >> i & 1 and i in switch[j]:
                on_sum += 1
         i range(n) range n if bit >> i & 1 and i in switch[j]:
                on_sum += 1
         bit >> i & 1 and i in switch[j] bit >> i & 1 bit >> i bit i 1 i in switch[j] i switch[j] switch j on_sum += 1 on_sum 1 if on_sum % 2 != rest[j]:
            break
     on_sum % 2 != rest[j] on_sum % 2 on_sum 2 rest[j] rest j break ans += 1 ans 1 print(ans) print ans ans = 0 0 ans m = map(int, input().split()) map(int, input().split()) m on_sum = 0 0 on_sum n, m = map(int, input().split()) map(int, input().split()) n ans += 1 1 ans switch = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)] [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)] switch on_sum += 1 1 on_sum rest = list(map(int, input().split())) list(map(int, input().split())) rest
n, m = map(int, input().split())
switch = [list(map(lambda x:int(x)-1, input().split()))[1:] for _ in range(m)]
rest = list(map(int, input().split()))
ans = 0
for bit in range(1<<n):
    for j in range(m):
        on_sum = 0
        for i in range(n):
            if bit >> i & 1 and i in switch[j]:
                on_sum += 1
        if on_sum % 2 != rest[j]:
            break
    else :
        ans += 1
print(ans)

