NN, MM = list(map(int,input().split()))
ARR = [list(map(int,input().split())) for l in range(MM)]
PMAP = list(map(int,input().split()))
#print(NN,MM,ARR)
switch = [[0 for j in range(NN)] for i in range(MM)]
for i in range(MM):
    for j in range(ARR[i][0]):
        switch[i][ARR[i][j+1]-1] = 1
#print(switch)

number_of_switch_on = 0
for j in range(2**NN):
#   print("bit-full-search step ", j)
    switch_on = 1
    for l in range(MM):
        checksum = 0
#        print("Checking Bulb", l+1)
        for k in range(NN):
            if (j>>k) & 1:
#               print("Switch ", k+1, " is on!")
                checksum += switch[l][k]
#        print("Checksum of switch ",l," is", checksum)
        if (checksum % 2) != PMAP[l]:
            switch_on = 0
    number_of_switch_on = number_of_switch_on + switch_on
#    print(" ")
#    print()
print(number_of_switch_on) NN, MM = list(map(int,input().split())) NN list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split MM list(map(int,input().split())) for l in range(MM) for l in range(MM) l range(MM) range MM for l in range(MM) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ARR = [list(map(int,input().split())) for l in range(MM)] ARR [list(map(int,input().split())) for l in range(MM)] PMAP = list(map(int,input().split())) PMAP list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split [0 for j in range(NN)] for i in range(MM) for i in range(MM) i range(MM) range MM for i in range(MM) [0 for j in range(NN)] switch = [[0 for j in range(NN)] for i in range(MM)] switch [[0 for j in range(NN)] for i in range(MM)] for i in range(MM):
    for j in range(ARR[i][0]):
        switch[i][ARR[i][j+1]-1] = 1
#print(switch) i range(MM) range MM for j in range(ARR[i][0]):
        switch[i][ARR[i][j+1]-1] = 1
#print(switch) j range(ARR[i][0]) range ARR[i][0] [i] ARR i 0 switch[i][ARR[i][j+1]-1] = 1 switch[i][ARR[i][j+1]-1] [i] switch i ARR[i][j+1]-1 ARR[i][j+1] [i] ARR i j+1 j 1 1 1 number_of_switch_on = 0 number_of_switch_on 0 for j in range(2**NN):
#   print("bit-full-search step ", j)
    switch_on = 1
    for l in range(MM):
        checksum = 0
#        print("Checking Bulb", l+1)
        for k in range(NN):
            if (j>>k) & 1:
#               print("Switch ", k+1, " is on!")
                checksum += switch[l][k]
#        print("Checksum of switch ",l," is", checksum)
        if (checksum % 2) != PMAP[l]:
            switch_on = 0
    number_of_switch_on = number_of_switch_on + switch_on
#    print(" ")
#    print() j range(2**NN) range 2**NN 2 NN switch_on = 1 switch_on 1 for l in range(MM):
        checksum = 0
#        print("Checking Bulb", l+1)
        for k in range(NN):
            if (j>>k) & 1:
#               print("Switch ", k+1, " is on!")
                checksum += switch[l][k]
#        print("Checksum of switch ",l," is", checksum)
        if (checksum % 2) != PMAP[l]:
            switch_on = 0
     l range(MM) range MM checksum = 0 checksum 0 for k in range(NN):
            if (j>>k) & 1:
#               print("Switch ", k+1, " is on!")
                checksum += switch[l][k]
#        print("Checksum of switch ",l," is", checksum)
         k range(NN) range NN if (j>>k) & 1:
#               print("Switch ", k+1, " is on!")
                checksum += switch[l][k]
#        print("Checksum of switch ",l," is", checksum)
         (j>>k) & 1 j>>k j k 1 checksum += switch[l][k] checksum switch[l][k] [l] switch l k if (checksum % 2) != PMAP[l]:
            switch_on = 0
     (checksum % 2) != PMAP[l] checksum % 2 checksum 2 PMAP[l] PMAP l switch_on = 0 switch_on 0 number_of_switch_on = number_of_switch_on + switch_on number_of_switch_on number_of_switch_on + switch_on number_of_switch_on switch_on print(number_of_switch_on) print number_of_switch_on MM = list(map(int,input().split())) list(map(int,input().split())) MM checksum += switch[l][k] switch[l][k] checksum ARR = [list(map(int,input().split())) for l in range(MM)] [list(map(int,input().split())) for l in range(MM)] ARR PMAP = list(map(int,input().split())) list(map(int,input().split())) PMAP checksum = 0 0 checksum number_of_switch_on = number_of_switch_on + switch_on number_of_switch_on + switch_on number_of_switch_on NN, MM = list(map(int,input().split())) list(map(int,input().split())) NN switch_on = 1 1 switch_on number_of_switch_on = 0 0 number_of_switch_on switch = [[0 for j in range(NN)] for i in range(MM)] [[0 for j in range(NN)] for i in range(MM)] switch switch_on = 0 0 switch_on
NN, MM = list(map(int,input().split()))
ARR = [list(map(int,input().split())) for l in range(MM)]
PMAP = list(map(int,input().split()))
#print(NN,MM,ARR)
switch = [[0 for j in range(NN)] for i in range(MM)]
for i in range(MM):
    for j in range(ARR[i][0]):
        switch[i][ARR[i][j+1]-1] = 1
#print(switch)

number_of_switch_on = 0
for j in range(2**NN):
#   print("bit-full-search step ", j)
    switch_on = 1
    for l in range(MM):
        checksum = 0
#        print("Checking Bulb", l+1)
        for k in range(NN):
            if (j>>k) & 1:
#               print("Switch ", k+1, " is on!")
                checksum += switch[l][k]
#        print("Checksum of switch ",l," is", checksum)
        if (checksum % 2) != PMAP[l]:
            switch_on = 0
    number_of_switch_on = number_of_switch_on + switch_on
#    print(" ")
#    print()
print(number_of_switch_on)