n, m = map(int, input().split())
K = [list(map(int, input().split())) for _ in range(m)]
P = list(map(int, input().split()))
ans = 0
for i in range(2**n):
    flag = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            flag[j] = True
    on = [False] * m
    for j in range(m):
        sw = 0
        for k in range(1, K[j][0] + 1):
            if flag[K[j][k] - 1]:
                sw += 1
        if sw % 2 == P[j]:
            on[j] = True
    if False not in on:
        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 _ in range(m) for _ in range(m) _ range(m) range m for _ in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split K = [list(map(int, input().split())) for _ in range(m)] K [list(map(int, input().split())) 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(2**n):
    flag = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            flag[j] = True
    on = [False] * m
    for j in range(m):
        sw = 0
        for k in range(1, K[j][0] + 1):
            if flag[K[j][k] - 1]:
                sw += 1
        if sw % 2 == P[j]:
            on[j] = True
    if False not in on:
        ans += 1 i range(2**n) range 2**n 2 n flag = [False] * n flag [False] * n [False] False n for j in range(n):
        if (i >> j) & 1:
            flag[j] = True
     j range(n) range n if (i >> j) & 1:
            flag[j] = True
     (i >> j) & 1 i >> j i j 1 flag[j] = True flag[j] flag j True on = [False] * m on [False] * m [False] False m for j in range(m):
        sw = 0
        for k in range(1, K[j][0] + 1):
            if flag[K[j][k] - 1]:
                sw += 1
        if sw % 2 == P[j]:
            on[j] = True
     j range(m) range m sw = 0 sw 0 for k in range(1, K[j][0] + 1):
            if flag[K[j][k] - 1]:
                sw += 1
         k range(1, K[j][0] + 1) range 1 K[j][0] + 1 K[j][0] [j] K j 0 1 if flag[K[j][k] - 1]:
                sw += 1
         flag[K[j][k] - 1] flag K[j][k] - 1 K[j][k] [j] K j k 1 sw += 1 sw 1 if sw % 2 == P[j]:
            on[j] = True
     sw % 2 == P[j] sw % 2 sw 2 P[j] P j on[j] = True on[j] on j True if False not in on:
        ans += 1 False not in on False on ans += 1 ans 1 print(ans) print ans flag = [False] * n [False] * n flag P = list(map(int, input().split())) list(map(int, input().split())) P m = map(int, input().split()) map(int, input().split()) m ans = 0 0 ans sw = 0 0 sw on = [False] * m [False] * m on K = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] K ans += 1 1 ans n, m = map(int, input().split()) map(int, input().split()) n sw += 1 1 sw
n, m = map(int, input().split())
K = [list(map(int, input().split())) for _ in range(m)]
P = list(map(int, input().split()))
ans = 0
for i in range(2**n):
    flag = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            flag[j] = True
    on = [False] * m
    for j in range(m):
        sw = 0
        for k in range(1, K[j][0] + 1):
            if flag[K[j][k] - 1]:
                sw += 1
        if sw % 2 == P[j]:
            on[j] = True
    if False not in on:
        ans += 1
print(ans)