n,m = map(int,input().split())
l = [[int(x) for x in input().split()[1:]] for i in range(m)]
odd_even = [int(x) for x in input().split()]


num = 0
limit = 2**n
ans = 0
while(num < limit):
    
    isOK = True
    for i in range(m):
        cnt = 0
        for x in l[i]:
            if((num >> (x-1)) & 1):
                cnt += 1
        
        if(cnt%2!=odd_even[i]):
            isOK = False
            break        
        
    if(isOK):
        ans += 1    
    
    num += 1

print(ans) n,m = map(int,input().split()) n map(int,input().split()) map int input().split() ().split () input split m [int(x) for x in input().split()[1:]] for i in range(m) for i in range(m) i range(m) range m for i in range(m) [int(x) for x in input().split()[1:]] l = [[int(x) for x in input().split()[1:]] for i in range(m)] l [[int(x) for x in input().split()[1:]] for i in range(m)] int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x odd_even = [int(x) for x in input().split()] odd_even [int(x) for x in input().split()] num = 0 num 0 limit = 2**n limit 2**n 2 n ans = 0 ans 0 while(num < limit):
    
    isOK = True
    for i in range(m):
        cnt = 0
        for x in l[i]:
            if((num >> (x-1)) & 1):
                cnt += 1
        
        if(cnt%2!=odd_even[i]):
            isOK = False
            break        
        
    if(isOK):
        ans += 1    
    
    num += 1 num < limit num limit isOK = True isOK True for i in range(m):
        cnt = 0
        for x in l[i]:
            if((num >> (x-1)) & 1):
                cnt += 1
        
        if(cnt%2!=odd_even[i]):
            isOK = False
            break        
        
     i range(m) range m cnt = 0 cnt 0 for x in l[i]:
            if((num >> (x-1)) & 1):
                cnt += 1
        
         x l[i] l i if((num >> (x-1)) & 1):
                cnt += 1
        
         (num >> (x-1)) & 1 num >> (x-1) num x-1 x 1 1 cnt += 1 cnt 1 if(cnt%2!=odd_even[i]):
            isOK = False
            break        
        
     cnt%2!=odd_even[i] cnt%2 cnt 2 odd_even[i] odd_even i isOK = False isOK False break if(isOK):
        ans += 1    
    
     isOK ans += 1 ans 1 num += 1 num 1 print(ans) print ans cnt += 1 1 cnt limit = 2**n 2**n limit isOK = True True isOK num = 0 0 num m = map(int,input().split()) map(int,input().split()) m l = [[int(x) for x in input().split()[1:]] for i in range(m)] [[int(x) for x in input().split()[1:]] for i in range(m)] l n,m = map(int,input().split()) map(int,input().split()) n isOK = False False isOK odd_even = [int(x) for x in input().split()] [int(x) for x in input().split()] odd_even ans = 0 0 ans cnt = 0 0 cnt num += 1 1 num ans += 1 1 ans
n,m = map(int,input().split())
l = [[int(x) for x in input().split()[1:]] for i in range(m)]
odd_even = [int(x) for x in input().split()]


num = 0
limit = 2**n
ans = 0
while(num < limit):
    
    isOK = True
    for i in range(m):
        cnt = 0
        for x in l[i]:
            if((num >> (x-1)) & 1):
                cnt += 1
        
        if(cnt%2!=odd_even[i]):
            isOK = False
            break        
        
    if(isOK):
        ans += 1    
    
    num += 1

print(ans)