N, M = map(int, input().split())

s_lst = [[False] * N for _ in range(M)]
for i in range(M):
    ks = list(map(int, input().split()))
    for j, value in enumerate(ks):
        if j != 0:
            s_lst[i][value-1] = True
p = list(map(int, input().split()))
# print(s_lst)

ans = 0
for bit in range(2**N):
    cnt = [0] * M
    for i in range(N):
        if (bit>>i) & 1 == 1:
            for j in range(M):
                if s_lst[j][i]:
                    cnt[j] += 1
    flug = True
    for i in range(M):
        if cnt[i] % 2 != p[i]:
            flug = False
    if flug:
        ans += 1
print(ans) N, M = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split M [False] * N for _ in range(M) for _ in range(M) _ range(M) range M for _ in range(M) [False] * N [False] False N s_lst = [[False] * N for _ in range(M)] s_lst [[False] * N for _ in range(M)] for i in range(M):
    ks = list(map(int, input().split()))
    for j, value in enumerate(ks):
        if j != 0:
            s_lst[i][value-1] = True i range(M) range M ks = list(map(int, input().split())) ks list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for j, value in enumerate(ks):
        if j != 0:
            s_lst[i][value-1] = True j value enumerate(ks) enumerate ks if j != 0:
            s_lst[i][value-1] = True j != 0 j 0 s_lst[i][value-1] = True s_lst[i][value-1] [i] s_lst i value-1 value 1 True 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 bit in range(2**N):
    cnt = [0] * M
    for i in range(N):
        if (bit>>i) & 1 == 1:
            for j in range(M):
                if s_lst[j][i]:
                    cnt[j] += 1
    flug = True
    for i in range(M):
        if cnt[i] % 2 != p[i]:
            flug = False
    if flug:
        ans += 1 bit range(2**N) range 2**N 2 N cnt = [0] * M cnt [0] * M [0] 0 M for i in range(N):
        if (bit>>i) & 1 == 1:
            for j in range(M):
                if s_lst[j][i]:
                    cnt[j] += 1
     i range(N) range N if (bit>>i) & 1 == 1:
            for j in range(M):
                if s_lst[j][i]:
                    cnt[j] += 1
     (bit>>i) & 1 == 1 (bit>>i) & 1 bit>>i bit i 1 1 for j in range(M):
                if s_lst[j][i]:
                    cnt[j] += 1
     j range(M) range M if s_lst[j][i]:
                    cnt[j] += 1
     s_lst[j][i] [j] s_lst j i cnt[j] += 1 cnt[j] cnt j 1 flug = True flug True for i in range(M):
        if cnt[i] % 2 != p[i]:
            flug = False
     i range(M) range M if cnt[i] % 2 != p[i]:
            flug = False
     cnt[i] % 2 != p[i] cnt[i] % 2 cnt[i] cnt i 2 p[i] p i flug = False flug False if flug:
        ans += 1 flug ans += 1 ans 1 print(ans) print ans cnt = [0] * M [0] * M cnt p = list(map(int, input().split())) list(map(int, input().split())) p flug = True True flug N, M = map(int, input().split()) map(int, input().split()) N ks = list(map(int, input().split())) list(map(int, input().split())) ks M = map(int, input().split()) map(int, input().split()) M flug = False False flug ans = 0 0 ans s_lst = [[False] * N for _ in range(M)] [[False] * N for _ in range(M)] s_lst ans += 1 1 ans
N, M = map(int, input().split())

s_lst = [[False] * N for _ in range(M)]
for i in range(M):
    ks = list(map(int, input().split()))
    for j, value in enumerate(ks):
        if j != 0:
            s_lst[i][value-1] = True
p = list(map(int, input().split()))
# print(s_lst)

ans = 0
for bit in range(2**N):
    cnt = [0] * M
    for i in range(N):
        if (bit>>i) & 1 == 1:
            for j in range(M):
                if s_lst[j][i]:
                    cnt[j] += 1
    flug = True
    for i in range(M):
        if cnt[i] % 2 != p[i]:
            flug = False
    if flug:
        ans += 1
print(ans)
