N,M = map(int,input().split())
ks = [list(map(int,input().split())) for i in range(M)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**N):
    s = i
    b = [0]*N
    for j in range(N):
        if s >= (2**(N-j-1)):
            s -= 2**(N-j-1)
            b[j] = 1
    for j in range(M):
        on = 0
        for k in range(ks[j][0]):
            if b[ks[j][k+1]-1] == 1:
                on += 1
        if on%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 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 ks = [list(map(int,input().split())) for i in range(M)] ks [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):
    s = i
    b = [0]*N
    for j in range(N):
        if s >= (2**(N-j-1)):
            s -= 2**(N-j-1)
            b[j] = 1
    for j in range(M):
        on = 0
        for k in range(ks[j][0]):
            if b[ks[j][k+1]-1] == 1:
                on += 1
        if on%2 != p[j]:
            break
    else:
        ans += 1 i range(2**N) range 2**N 2 N s = i s i b = [0]*N b [0]*N [0] 0 N for j in range(N):
        if s >= (2**(N-j-1)):
            s -= 2**(N-j-1)
            b[j] = 1
     j range(N) range N if s >= (2**(N-j-1)):
            s -= 2**(N-j-1)
            b[j] = 1
     s >= (2**(N-j-1)) s 2**(N-j-1) 2 N-j-1 N-j N j 1 s -= 2**(N-j-1) s 2**(N-j-1) 2 N-j-1 N-j N j 1 b[j] = 1 b[j] b j 1 for j in range(M):
        on = 0
        for k in range(ks[j][0]):
            if b[ks[j][k+1]-1] == 1:
                on += 1
        if on%2 != p[j]:
            break
    else:
        ans += 1 j range(M) range M on = 0 on 0 for k in range(ks[j][0]):
            if b[ks[j][k+1]-1] == 1:
                on += 1
         k range(ks[j][0]) range ks[j][0] [j] ks j 0 if b[ks[j][k+1]-1] == 1:
                on += 1
         b[ks[j][k+1]-1] == 1 b[ks[j][k+1]-1] b ks[j][k+1]-1 ks[j][k+1] [j] ks j k+1 k 1 1 1 on += 1 on 1 if on%2 != p[j]:
            break
     on%2 != p[j] on%2 on 2 p[j] p j break ans += 1 ans 1 print(ans) print ans p = list(map(int,input().split())) list(map(int,input().split())) p ans = 0 0 ans s = i i s s -= 2**(N-j-1) 2**(N-j-1) s ks = [list(map(int,input().split())) for i in range(M)] [list(map(int,input().split())) for i in range(M)] ks on = 0 0 on ans += 1 1 ans on += 1 1 on M = map(int,input().split()) map(int,input().split()) M b = [0]*N [0]*N b N,M = map(int,input().split()) map(int,input().split()) N
N,M = map(int,input().split())
ks = [list(map(int,input().split())) for i in range(M)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**N):
    s = i
    b = [0]*N
    for j in range(N):
        if s >= (2**(N-j-1)):
            s -= 2**(N-j-1)
            b[j] = 1
    for j in range(M):
        on = 0
        for k in range(ks[j][0]):
            if b[ks[j][k+1]-1] == 1:
                on += 1
        if on%2 != p[j]:
            break
    else:
        ans += 1
print(ans)