you can map the ends of each series of ones using diff:
C = [diff(B, 1, 1) == -1; B(end, :)];
then check each occurence of C to see if it has a preceding index in A and no index in C between the two.
If the previous occurence of C is prior to the previous occurence of A it is a valid series
but if there is an occurence of C between the current C index and the previous occurence of A it means this is the end of a false positive chain, then you can zero out everything from the previous C index +1 up to the current C index