N, M = map(int, input().split())
lamps = [list(map(lambda x: int(x) - 1, input().split()))[1:] for _ in range(M)]

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

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

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

ans = 0
for i in range(1 << N):
    for r in range(M):
        on_sum = 0
        for j in range(N):
            if (i >> j) & 1 and j in lamps[r]:
                on_sum += 1
        if on_sum % 2 != p[r]:
            break
    else:
        ans += 1
print(ans)


