To flank a foe, you and your ally must be on opposite sides of the creature. A line drawn between the center of your space and the center of your ally's space must pass through opposite sides or opposite corners of the foe's space
It is all simple when medium creatures without reach are flanking Small or larger creatures.
Pink are the Large enemies, green the flanked Medium creature:
A is clear, the line between the centers goes through the sides
B is questionable, the line between the centers only touches the sides of the flanked creature's space, does not really go through them
So the question: is M flanked in case B?