#N = int(input())
n, m = map(int, input().split())
#hl = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
pl = list(map(int, input().split()))
count=0
for i in range(2**n):
    b = bin(i)
    switch = [False for i in range(n)]
    boollist=[]
    for j in range(n):
        if ((i >> j) & 1):
            switch[j] = True
    for j in range(m):
        k = l[j][0]
        sl = l[j][1:]
        total=0
        for sij in sl:
            if switch[sij-1]:
                total+=1
        if total % 2 == pl[j]:
            boollist.append(True)
        else:
            boollist.append(False)
    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 i in range(m) for i in range(m) i range(m) range m for i in range(m) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split l = [list(map(int, input().split())) for i in range(m)] l [list(map(int, input().split())) for i in range(m)] pl = list(map(int, input().split())) pl 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)
    switch = [False for i in range(n)]
    boollist=[]
    for j in range(n):
        if ((i >> j) & 1):
            switch[j] = True
    for j in range(m):
        k = l[j][0]
        sl = l[j][1:]
        total=0
        for sij in sl:
            if switch[sij-1]:
                total+=1
        if total % 2 == pl[j]:
            boollist.append(True)
        else:
            boollist.append(False)
    if all(boollist):
        count += 1 i range(2**n) range 2**n 2 n b = bin(i) b bin(i) bin i False for i in range(n) for i in range(n) i range(n) range n for i in range(n) False switch = [False for i in range(n)] switch [False for i in range(n)] boollist=[] boollist [] for j in range(n):
        if ((i >> j) & 1):
            switch[j] = True
     j range(n) range n if ((i >> j) & 1):
            switch[j] = True
     (i >> j) & 1 i >> j i j 1 switch[j] = True switch[j] switch j True for j in range(m):
        k = l[j][0]
        sl = l[j][1:]
        total=0
        for sij in sl:
            if switch[sij-1]:
                total+=1
        if total % 2 == pl[j]:
            boollist.append(True)
        else:
            boollist.append(False)
     j range(m) range m k = l[j][0] k l[j][0] [j] l j 0 sl = l[j][1:] sl l[j][1:] [j] l j 1: 1 total=0 total 0 for sij in sl:
            if switch[sij-1]:
                total+=1
         sij sl if switch[sij-1]:
                total+=1
         switch[sij-1] switch sij-1 sij 1 total+=1 total 1 if total % 2 == pl[j]:
            boollist.append(True)
        else:
            boollist.append(False)
     total % 2 == pl[j] total % 2 total 2 pl[j] pl j boollist.append(True) boollist.append boollist append True boollist.append(False) boollist.append boollist append False if all(boollist):
        count += 1 all(boollist) all boollist count += 1 count 1 print(count) print count boollist=[] [] boollist m = map(int, input().split()) map(int, input().split()) m pl = list(map(int, input().split())) list(map(int, input().split())) pl b = bin(i) bin(i) b total=0 0 total k = l[j][0] l[j][0] k n, m = map(int, input().split()) map(int, input().split()) n total+=1 1 total switch = [False for i in range(n)] [False for i in range(n)] switch l = [list(map(int, input().split())) for i in range(m)] [list(map(int, input().split())) for i in range(m)] l sl = l[j][1:] l[j][1:] sl count=0 0 count count += 1 1 count
#N = int(input())
n, m = map(int, input().split())
#hl = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
pl = list(map(int, input().split()))
count=0
for i in range(2**n):
    b = bin(i)
    switch = [False for i in range(n)]
    boollist=[]
    for j in range(n):
        if ((i >> j) & 1):
            switch[j] = True
    for j in range(m):
        k = l[j][0]
        sl = l[j][1:]
        total=0
        for sij in sl:
            if switch[sij-1]:
                total+=1
        if total % 2 == pl[j]:
            boollist.append(True)
        else:
            boollist.append(False)
    if all(boollist):
        count += 1
print(count)

