N, M = list(map(int, input().split()))
S = [0]*M
answer = 0

for i in range(M):
    S[i] = list(map(int, input().split()))

P = list(map(int, input().split()))

for i in range(2**N):
    mb = '0' + str(N) + 'b'
    bi = format(i, mb)
    count = 0
    for j in range(M):
        on = 0
        for k in range(S[j][0]):
            on += int(bi[-S[j][k+1]])
        if on%2 == P[j]:
            count += 1
    if count == M:
        answer += 1

print(answer) N, M = list(map(int, input().split())) N list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split M S = [0]*M S [0]*M [0] 0 M answer = 0 answer 0 for i in range(M):
    S[i] = list(map(int, input().split())) i range(M) range M S[i] = list(map(int, input().split())) S[i] S i list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split P = list(map(int, input().split())) P list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for i in range(2**N):
    mb = '0' + str(N) + 'b'
    bi = format(i, mb)
    count = 0
    for j in range(M):
        on = 0
        for k in range(S[j][0]):
            on += int(bi[-S[j][k+1]])
        if on%2 == P[j]:
            count += 1
    if count == M:
        answer += 1 i range(2**N) range 2**N 2 N mb = '0' + str(N) + 'b' mb '0' + str(N) + 'b' '0' + str(N) '0' str(N) str N 'b' bi = format(i, mb) bi format(i, mb) format i mb count = 0 count 0 for j in range(M):
        on = 0
        for k in range(S[j][0]):
            on += int(bi[-S[j][k+1]])
        if on%2 == P[j]:
            count += 1
     j range(M) range M on = 0 on 0 for k in range(S[j][0]):
            on += int(bi[-S[j][k+1]])
         k range(S[j][0]) range S[j][0] [j] S j 0 on += int(bi[-S[j][k+1]]) on int(bi[-S[j][k+1]]) int bi[-S[j][k+1]] bi -S[j][k+1] S[j][k+1] [j] S j k+1 k 1 if on%2 == P[j]:
            count += 1
     on%2 == P[j] on%2 on 2 P[j] P j count += 1 count 1 if count == M:
        answer += 1 count == M count M answer += 1 answer 1 print(answer) print answer P = list(map(int, input().split())) list(map(int, input().split())) P count += 1 1 count M = list(map(int, input().split())) list(map(int, input().split())) M answer += 1 1 answer S = [0]*M [0]*M S bi = format(i, mb) format(i, mb) bi N, M = list(map(int, input().split())) list(map(int, input().split())) N on = 0 0 on count = 0 0 count mb = '0' + str(N) + 'b' '0' + str(N) + 'b' mb answer = 0 0 answer on += int(bi[-S[j][k+1]]) int(bi[-S[j][k+1]]) on
N, M = list(map(int, input().split()))
S = [0]*M
answer = 0

for i in range(M):
    S[i] = list(map(int, input().split()))

P = list(map(int, input().split()))

for i in range(2**N):
    mb = '0' + str(N) + 'b'
    bi = format(i, mb)
    count = 0
    for j in range(M):
        on = 0
        for k in range(S[j][0]):
            on += int(bi[-S[j][k+1]])
        if on%2 == P[j]:
            count += 1
    if count == M:
        answer += 1

print(answer)