n , m = map(int, input().split())

lis = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

count = 0

for i in range(2**n):
    b = bin(i)
    sw = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            sw[j] = True

    boollist = []
    for j in range(m):
        k = lis[j][0]
        sl = lis[j][1:]
        total = 0

        for x in sl:
            if sw[x-1]:
                total += 1
        
        if total % 2 == p[j]:
            boollist.append(1)
        else:
            boollist.append(0)
    
    if all(boollist):
        count += 1

print(count) 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 lis = [list(map(int, input().split())) for _ in range(m)] lis [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 count = 0 count 0 for i in range(2**n):
    b = bin(i)
    sw = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            sw[j] = True

    boollist = []
    for j in range(m):
        k = lis[j][0]
        sl = lis[j][1:]
        total = 0

        for x in sl:
            if sw[x-1]:
                total += 1
        
        if total % 2 == p[j]:
            boollist.append(1)
        else:
            boollist.append(0)
    
    if all(boollist):
        count += 1 i range(2**n) range 2**n 2 n b = bin(i) b bin(i) bin i sw = [False] * n sw [False] * n [False] False n for j in range(n):
        if (i >> j) & 1:
            sw[j] = True

     j range(n) range n if (i >> j) & 1:
            sw[j] = True

     (i >> j) & 1 i >> j i j 1 sw[j] = True sw[j] sw j True boollist = [] boollist [] for j in range(m):
        k = lis[j][0]
        sl = lis[j][1:]
        total = 0

        for x in sl:
            if sw[x-1]:
                total += 1
        
        if total % 2 == p[j]:
            boollist.append(1)
        else:
            boollist.append(0)
    
     j range(m) range m k = lis[j][0] k lis[j][0] [j] lis j 0 sl = lis[j][1:] sl lis[j][1:] [j] lis j 1: 1 total = 0 total 0 for x in sl:
            if sw[x-1]:
                total += 1
        
         x sl if sw[x-1]:
                total += 1
        
         sw[x-1] sw x-1 x 1 total += 1 total 1 if total % 2 == p[j]:
            boollist.append(1)
        else:
            boollist.append(0)
    
     total % 2 == p[j] total % 2 total 2 p[j] p j boollist.append(1) boollist.append boollist append 1 boollist.append(0) boollist.append boollist append 0 if all(boollist):
        count += 1 all(boollist) all boollist count += 1 count 1 print(count) print count lis = [list(map(int, input().split())) for _ in range(m)] [list(map(int, input().split())) for _ in range(m)] lis boollist = [] [] boollist sl = lis[j][1:] lis[j][1:] sl count += 1 1 count total = 0 0 total b = bin(i) bin(i) b n , m = map(int, input().split()) map(int, input().split()) n count = 0 0 count k = lis[j][0] lis[j][0] k total += 1 1 total m = map(int, input().split()) map(int, input().split()) m p = list(map(int, input().split())) list(map(int, input().split())) p sw = [False] * n [False] * n sw
n , m = map(int, input().split())

lis = [list(map(int, input().split())) for _ in range(m)]
p = list(map(int, input().split()))

count = 0

for i in range(2**n):
    b = bin(i)
    sw = [False] * n
    for j in range(n):
        if (i >> j) & 1:
            sw[j] = True

    boollist = []
    for j in range(m):
        k = lis[j][0]
        sl = lis[j][1:]
        total = 0

        for x in sl:
            if sw[x-1]:
                total += 1
        
        if total % 2 == p[j]:
            boollist.append(1)
        else:
            boollist.append(0)
    
    if all(boollist):
        count += 1

print(count)