In order for the “system/body” to be stable, the sum of the moments about the contact point between $M$ and the table must be zero.
The top diagrams show the center of mass ($cm$) above the table, or $Y>0$ and the bottom diagrams show the center of mass below the table, or $Y<0$. In both cases, the left diagrams show that the $cm$ acts vertically through the contact point and thus contributes no moment. As long as the small masses $m$ are perfectly balanced, it doesn’t matter if the $cm$ is above or below the table.
Now look at the top right diagram. I have rotated the system clockwise simulating the small mass $m$ on the right causing an imbalanced clockwise moment. I have rotated the system 20 degrees in order to exaggerate the effect. Note that the center of mass is no longer acting through the point of contact and is contributing an additional clockwise moment, furthering the instability.
Now look at the bottom right diagram. The same rotation to the right results in the $cm$ contributing a counter-clockwise moment, counteracting the clockwise moment due to the small mass unequal moment clockwise.
Consequently, locating the $cm$ below the contact point tends to stabilize the structure whereas locating it above the contact point contributes to instability.
Hope this helps.