n,m=map(int,input().split())
light=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    state=[0]*n
    for j in range(n):
        if (i>>j&1):
            state[j]=1
    light_num=0
    for k in range(m):
        switch_num=0
        for l in range(1,light[k][0]+1):
            if state[light[k][l]-1]==1:
                switch_num+=1
        if switch_num%2==p[k]:
            light_num+=1
    if light_num==m:
        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 light=[list(map(int,input().split())) for _ in range(m)] light [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):
    state=[0]*n
    for j in range(n):
        if (i>>j&1):
            state[j]=1
    light_num=0
    for k in range(m):
        switch_num=0
        for l in range(1,light[k][0]+1):
            if state[light[k][l]-1]==1:
                switch_num+=1
        if switch_num%2==p[k]:
            light_num+=1
    if light_num==m:
        ans+=1 i range(2**n) range 2**n 2 n state=[0]*n state [0]*n [0] 0 n for j in range(n):
        if (i>>j&1):
            state[j]=1
     j range(n) range n if (i>>j&1):
            state[j]=1
     i>>j&1 i>>j i j 1 state[j]=1 state[j] state j 1 light_num=0 light_num 0 for k in range(m):
        switch_num=0
        for l in range(1,light[k][0]+1):
            if state[light[k][l]-1]==1:
                switch_num+=1
        if switch_num%2==p[k]:
            light_num+=1
     k range(m) range m switch_num=0 switch_num 0 for l in range(1,light[k][0]+1):
            if state[light[k][l]-1]==1:
                switch_num+=1
         l range(1,light[k][0]+1) range 1 light[k][0]+1 light[k][0] [k] light k 0 1 if state[light[k][l]-1]==1:
                switch_num+=1
         state[light[k][l]-1]==1 state[light[k][l]-1] state light[k][l]-1 light[k][l] [k] light k l 1 1 switch_num+=1 switch_num 1 if switch_num%2==p[k]:
            light_num+=1
     switch_num%2==p[k] switch_num%2 switch_num 2 p[k] p k light_num+=1 light_num 1 if light_num==m:
        ans+=1 light_num==m light_num m ans+=1 ans 1 print(ans) print ans m=map(int,input().split()) map(int,input().split()) m ans=0 0 ans light_num=0 0 light_num ans+=1 1 ans light=[list(map(int,input().split())) for _ in range(m)] [list(map(int,input().split())) for _ in range(m)] light switch_num=0 0 switch_num p=list(map(int,input().split())) list(map(int,input().split())) p state=[0]*n [0]*n state n,m=map(int,input().split()) map(int,input().split()) n light_num+=1 1 light_num switch_num+=1 1 switch_num
n,m=map(int,input().split())
light=[list(map(int,input().split())) for _ in range(m)]
p=list(map(int,input().split()))
ans=0
for i in range(2**n):
    state=[0]*n
    for j in range(n):
        if (i>>j&1):
            state[j]=1
    light_num=0
    for k in range(m):
        switch_num=0
        for l in range(1,light[k][0]+1):
            if state[light[k][l]-1]==1:
                switch_num+=1
        if switch_num%2==p[k]:
            light_num+=1
    if light_num==m:
        ans+=1
print(ans)