Taking the moments about the end X:
If force P was applied at the end X. Taking the moments about the end Y: