n, m = map(int, input().split())
switches = [list(map(int, input().split())) for _ in range(m)]
correct = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    # pattern
    flg = True
    for p in range(m):
        cnt = 0
        for j in range(n):
            # 右シフト
            if (i >> j) & 1:
                if (j + 1) in switches[p][1:]:
                    cnt += 1
        if cnt % 2 != correct[p]:
            flg = False
            break
    if flg:
        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 switches = [list(map(int, input().split())) for _ in range(m)] switches [list(map(int, input().split())) for _ in range(m)] correct = list(map(int, input().split())) correct 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):
    # pattern
    flg = True
    for p in range(m):
        cnt = 0
        for j in range(n):
            # 右シフト
            if (i >> j) & 1:
                if (j + 1) in switches[p][1:]:
                    cnt += 1
        if cnt % 2 != correct[p]:
            flg = False
            break
    if flg:
        ans += 1 i range(2 ** n) range 2 ** n 2 n flg = True flg True for p in range(m):
        cnt = 0
        for j in range(n):
            # 右シフト
            if (i >> j) & 1:
                if (j + 1) in switches[p][1:]:
                    cnt += 1
        if cnt % 2 != correct[p]:
            flg = False
            break
     p range(m) range m cnt = 0 cnt 0 for j in range(n):
            # 右シフト
            if (i >> j) & 1:
                if (j + 1) in switches[p][1:]:
                    cnt += 1
         j range(n) range n if (i >> j) & 1:
                if (j + 1) in switches[p][1:]:
                    cnt += 1
         (i >> j) & 1 i >> j i j 1 if (j + 1) in switches[p][1:]:
                    cnt += 1
         (j + 1) in switches[p][1:] j + 1 j 1 switches[p][1:] [p] switches p 1: 1 cnt += 1 cnt 1 if cnt % 2 != correct[p]:
            flg = False
            break
     cnt % 2 != correct[p] cnt % 2 cnt 2 correct[p] correct p flg = False flg False break if flg:
        ans += 1 flg ans += 1 ans 1 print(ans) print ans m = map(int, input().split()) map(int, input().split()) m flg = False False flg correct = list(map(int, input().split())) list(map(int, input().split())) correct flg = True True flg switches = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] switches ans += 1 1 ans ans = 0 0 ans cnt = 0 0 cnt cnt += 1 1 cnt n, m = map(int, input().split()) map(int, input().split()) n
n, m = map(int, input().split())
switches = [list(map(int, input().split())) for _ in range(m)]
correct = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    # pattern
    flg = True
    for p in range(m):
        cnt = 0
        for j in range(n):
            # 右シフト
            if (i >> j) & 1:
                if (j + 1) in switches[p][1:]:
                    cnt += 1
        if cnt % 2 != correct[p]:
            flg = False
            break
    if flg:
        ans += 1

print(ans)
