n,m = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**n):
    onoffs = [int(j) for j in list(bin(i)[2:].zfill(n))]
    Flag = True
    for lamp in range(m):
        k = a[lamp][0]
        info = [l - 1 for l in  a[lamp][1:]]
        tmp = 0
        for index in info:
            if onoffs[index]:
                tmp += 1
        if tmp % 2 != p[lamp]:
            Flag = False
            break
    if Flag:
        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 a = [list(map(int,input().split())) for _ in range(m)] a [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):
    onoffs = [int(j) for j in list(bin(i)[2:].zfill(n))]
    Flag = True
    for lamp in range(m):
        k = a[lamp][0]
        info = [l - 1 for l in  a[lamp][1:]]
        tmp = 0
        for index in info:
            if onoffs[index]:
                tmp += 1
        if tmp % 2 != p[lamp]:
            Flag = False
            break
    if Flag:
        ans += 1 i range(2**n) range 2**n 2 n int(j) for j in list(bin(i)[2:].zfill(n)) for j in list(bin(i)[2:].zfill(n)) j list(bin(i)[2:].zfill(n)) list bin(i)[2:].zfill(n) [2:].zfill [2:] (i) bin i 2: 2 zfill n for j in list(bin(i)[2:].zfill(n)) int(j) int j onoffs = [int(j) for j in list(bin(i)[2:].zfill(n))] onoffs [int(j) for j in list(bin(i)[2:].zfill(n))] Flag = True Flag True for lamp in range(m):
        k = a[lamp][0]
        info = [l - 1 for l in  a[lamp][1:]]
        tmp = 0
        for index in info:
            if onoffs[index]:
                tmp += 1
        if tmp % 2 != p[lamp]:
            Flag = False
            break
     lamp range(m) range m k = a[lamp][0] k a[lamp][0] [lamp] a lamp 0 l - 1 for l in  a[lamp][1:] for l in  a[lamp][1:] l a[lamp][1:] [lamp] a lamp 1: 1 for l in  a[lamp][1:] l - 1 l 1 info = [l - 1 for l in  a[lamp][1:]] info [l - 1 for l in  a[lamp][1:]] tmp = 0 tmp 0 for index in info:
            if onoffs[index]:
                tmp += 1
         index info if onoffs[index]:
                tmp += 1
         onoffs[index] onoffs index tmp += 1 tmp 1 if tmp % 2 != p[lamp]:
            Flag = False
            break
     tmp % 2 != p[lamp] tmp % 2 tmp 2 p[lamp] p lamp Flag = False Flag False break if Flag:
        ans += 1 Flag ans += 1 ans 1 print(ans) print ans m = map(int,input().split()) map(int,input().split()) m tmp += 1 1 tmp Flag = False False Flag ans += 1 1 ans a = [list(map(int,input().split())) for _ in range(m)] [list(map(int,input().split())) for _ in range(m)] a Flag = True True Flag p = list(map(int,input().split())) list(map(int,input().split())) p onoffs = [int(j) for j in list(bin(i)[2:].zfill(n))] [int(j) for j in list(bin(i)[2:].zfill(n))] onoffs info = [l - 1 for l in  a[lamp][1:]] [l - 1 for l in  a[lamp][1:]] info n,m = map(int,input().split()) map(int,input().split()) n ans = 0 0 ans k = a[lamp][0] a[lamp][0] k tmp = 0 0 tmp
n,m = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(m)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**n):
    onoffs = [int(j) for j in list(bin(i)[2:].zfill(n))]
    Flag = True
    for lamp in range(m):
        k = a[lamp][0]
        info = [l - 1 for l in  a[lamp][1:]]
        tmp = 0
        for index in info:
            if onoffs[index]:
                tmp += 1
        if tmp % 2 != p[lamp]:
            Flag = False
            break
    if Flag:
        ans += 1
print(ans)