There are two possibilities. The point P is distance d away from the mass of 5M. Let a third body of mass m be present at P.
Gravitational force due to 5M = G 5M m/ d² towards 5M.
Gravitational force due to M = G M m / (X-d)² towards M.
If the net force is zero, then the above forces are equal in magnitude.
So, equating both forces we get, 5/d² = 1/(X-d)²
5X² + 5d² - 10 X d = d²
4 d² - 10 X d + 5X² = 0
d = [10 X +- √(100X² -80X²) ]/8 = (10 X +- 2√5 X )/8 = (5+-√5)X/4
Distance from 5M, d = 0.69 X and 1.809 X at which the net gravity is zero due to both masses.