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

ans = 0
for i in range(2 ** n):
    i_str = bin(i)[2:].zfill(n)
    onNum = 0
    for num, ks in enumerate(KS):
        k = ks[0]
        s = ks[1:]
        p = P[num]
        on = 0
        for sw in s:
            if i_str[sw - 1] == "1":
                on += 1
        if on % 2 == p:
            onNum += 1
    if onNum == m:
        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 KS = [list(map(int, input().split())) for _ in range(m)] KS [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):
    i_str = bin(i)[2:].zfill(n)
    onNum = 0
    for num, ks in enumerate(KS):
        k = ks[0]
        s = ks[1:]
        p = P[num]
        on = 0
        for sw in s:
            if i_str[sw - 1] == "1":
                on += 1
        if on % 2 == p:
            onNum += 1
    if onNum == m:
        ans += 1 i range(2 ** n) range 2 ** n 2 n i_str = bin(i)[2:].zfill(n) i_str bin(i)[2:].zfill(n) [2:].zfill [2:] (i) bin i 2: 2 zfill n onNum = 0 onNum 0 for num, ks in enumerate(KS):
        k = ks[0]
        s = ks[1:]
        p = P[num]
        on = 0
        for sw in s:
            if i_str[sw - 1] == "1":
                on += 1
        if on % 2 == p:
            onNum += 1
     num ks enumerate(KS) enumerate KS k = ks[0] k ks[0] ks 0 s = ks[1:] s ks[1:] ks 1: 1 p = P[num] p P[num] P num on = 0 on 0 for sw in s:
            if i_str[sw - 1] == "1":
                on += 1
         sw s if i_str[sw - 1] == "1":
                on += 1
         i_str[sw - 1] == "1" i_str[sw - 1] i_str sw - 1 sw 1 "1" on += 1 on 1 if on % 2 == p:
            onNum += 1
     on % 2 == p on % 2 on 2 p onNum += 1 onNum 1 if onNum == m:
        ans += 1 onNum == m onNum m ans += 1 ans 1 print(ans) print ans P = list(map(int, input().split())) list(map(int, input().split())) P i_str = bin(i)[2:].zfill(n) bin(i)[2:].zfill(n) i_str KS = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] KS m = map(int, input().split()) map(int, input().split()) m ans += 1 1 ans onNum += 1 1 onNum n , m = map(int, input().split()) map(int, input().split()) n on = 0 0 on onNum = 0 0 onNum s = ks[1:] ks[1:] s on += 1 1 on k = ks[0] ks[0] k p = P[num] P[num] p ans = 0 0 ans
n , m = map(int, input().split())
KS = [list(map(int, input().split())) for _ in range(m)]
P = list(map(int, input().split()))

ans = 0
for i in range(2 ** n):
    i_str = bin(i)[2:].zfill(n)
    onNum = 0
    for num, ks in enumerate(KS):
        k = ks[0]
        s = ks[1:]
        p = P[num]
        on = 0
        for sw in s:
            if i_str[sw - 1] == "1":
                on += 1
        if on % 2 == p:
            onNum += 1
    if onNum == m:
        ans += 1

print(ans)


        
        
