N, M = map(int, input().split())
I = []
for _ in range(M):
    I.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0

for i in range(2 ** N):
    flg = 1
    for j in range(M):
        o = 0
        for k in range(1, I[j][0]+1):
            if (i >> (I[j][k]-1)) & 1:
                o += 1
        if o % 2 != p[j]:
            flg = 0
            break
    if flg == 1:
        ans += 1
print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M I = [] I [] for _ in range(M):
    I.append(list(map(int, input().split()))) _ range(M) range M I.append(list(map(int, input().split()))) I.append I append 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 ans = 0 ans 0 for i in range(2 ** N):
    flg = 1
    for j in range(M):
        o = 0
        for k in range(1, I[j][0]+1):
            if (i >> (I[j][k]-1)) & 1:
                o += 1
        if o % 2 != p[j]:
            flg = 0
            break
    if flg == 1:
        ans += 1 i range(2 ** N) range 2 ** N 2 N flg = 1 flg 1 for j in range(M):
        o = 0
        for k in range(1, I[j][0]+1):
            if (i >> (I[j][k]-1)) & 1:
                o += 1
        if o % 2 != p[j]:
            flg = 0
            break
     j range(M) range M o = 0 o 0 for k in range(1, I[j][0]+1):
            if (i >> (I[j][k]-1)) & 1:
                o += 1
         k range(1, I[j][0]+1) range 1 I[j][0]+1 I[j][0] [j] I j 0 1 if (i >> (I[j][k]-1)) & 1:
                o += 1
         (i >> (I[j][k]-1)) & 1 i >> (I[j][k]-1) i I[j][k]-1 I[j][k] [j] I j k 1 1 o += 1 o 1 if o % 2 != p[j]:
            flg = 0
            break
     o % 2 != p[j] o % 2 o 2 p[j] p j flg = 0 flg 0 break if flg == 1:
        ans += 1 flg == 1 flg 1 ans += 1 ans 1 print(ans) print ans ans = 0 0 ans flg = 1 1 flg I = [] [] I o += 1 1 o flg = 0 0 flg ans += 1 1 ans o = 0 0 o N, M = map(int, input().split()) map(int, input().split()) N M = map(int, input().split()) map(int, input().split()) M p = list(map(int, input().split())) list(map(int, input().split())) p
N, M = map(int, input().split())
I = []
for _ in range(M):
    I.append(list(map(int, input().split())))
p = list(map(int, input().split()))

ans = 0

for i in range(2 ** N):
    flg = 1
    for j in range(M):
        o = 0
        for k in range(1, I[j][0]+1):
            if (i >> (I[j][k]-1)) & 1:
                o += 1
        if o % 2 != p[j]:
            flg = 0
            break
    if flg == 1:
        ans += 1
print(ans)