n, m = list(map(int, input().split()))
switches = [list(map(int, input().split())) for i in range(m)]
ps = list(map(int, input().split()))

ans = 0
for idx in range(2**n):
    switch_on = [False] * n
    for s in range(n):
        if 2**s & idx > 0:
            switch_on[s] = True

    ok = True
    # ビット上位がN，下位が1
    for lamp in range(m):
        num_on_switch = 0
        for s in switches[lamp - 1][1:]:
            if switch_on[s-1] == True:
                num_on_switch += 1
        
        if num_on_switch % 2 != ps[lamp-1]:
            ok = False
        if not ok:
            break
    
    if ok:
        ans += 1

print(ans) n, m = list(map(int, input().split())) n list(map(int, input().split())) list 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 switches = [list(map(int, input().split())) for i in range(m)] switches [list(map(int, input().split())) for i in range(m)] ps = list(map(int, input().split())) ps list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 for idx in range(2**n):
    switch_on = [False] * n
    for s in range(n):
        if 2**s & idx > 0:
            switch_on[s] = True

    ok = True
    # ビット上位がN，下位が1
    for lamp in range(m):
        num_on_switch = 0
        for s in switches[lamp - 1][1:]:
            if switch_on[s-1] == True:
                num_on_switch += 1
        
        if num_on_switch % 2 != ps[lamp-1]:
            ok = False
        if not ok:
            break
    
    if ok:
        ans += 1 idx range(2**n) range 2**n 2 n switch_on = [False] * n switch_on [False] * n [False] False n for s in range(n):
        if 2**s & idx > 0:
            switch_on[s] = True

     s range(n) range n if 2**s & idx > 0:
            switch_on[s] = True

     2**s & idx > 0 2**s & idx 2**s 2 s idx 0 switch_on[s] = True switch_on[s] switch_on s True ok = True ok True for lamp in range(m):
        num_on_switch = 0
        for s in switches[lamp - 1][1:]:
            if switch_on[s-1] == True:
                num_on_switch += 1
        
        if num_on_switch % 2 != ps[lamp-1]:
            ok = False
        if not ok:
            break
    
     lamp range(m) range m num_on_switch = 0 num_on_switch 0 for s in switches[lamp - 1][1:]:
            if switch_on[s-1] == True:
                num_on_switch += 1
        
         s switches[lamp - 1][1:] [lamp - 1] switches lamp - 1 lamp 1 1: 1 if switch_on[s-1] == True:
                num_on_switch += 1
        
         switch_on[s-1] == True switch_on[s-1] switch_on s-1 s 1 True num_on_switch += 1 num_on_switch 1 if num_on_switch % 2 != ps[lamp-1]:
            ok = False
         num_on_switch % 2 != ps[lamp-1] num_on_switch % 2 num_on_switch 2 ps[lamp-1] ps lamp-1 lamp 1 ok = False ok False if not ok:
            break
    
     not ok ok break if ok:
        ans += 1 ok ans += 1 ans 1 print(ans) print ans num_on_switch += 1 1 num_on_switch n, m = list(map(int, input().split())) list(map(int, input().split())) n ps = list(map(int, input().split())) list(map(int, input().split())) ps ok = True True ok ans = 0 0 ans switches = [list(map(int, input().split())) for i in range(m)] [list(map(int, input().split())) for i in range(m)] switches num_on_switch = 0 0 num_on_switch ok = False False ok m = list(map(int, input().split())) list(map(int, input().split())) m ans += 1 1 ans switch_on = [False] * n [False] * n switch_on
n, m = list(map(int, input().split()))
switches = [list(map(int, input().split())) for i in range(m)]
ps = list(map(int, input().split()))

ans = 0
for idx in range(2**n):
    switch_on = [False] * n
    for s in range(n):
        if 2**s & idx > 0:
            switch_on[s] = True

    ok = True
    # ビット上位がN，下位が1
    for lamp in range(m):
        num_on_switch = 0
        for s in switches[lamp - 1][1:]:
            if switch_on[s-1] == True:
                num_on_switch += 1
        
        if num_on_switch % 2 != ps[lamp-1]:
            ok = False
        if not ok:
            break
    
    if ok:
        ans += 1

print(ans)
