Given fixed but arbitrary $M>0\land P>0$, define the function $G:\mathbb{R}\rightarrow\mathbb{R}$ by the cubic polynomial
$$G{\left(t\right)}:=t^{3}-\frac{1}{2M}t^{2}+\frac{P-2M}{2MP^{3}},$$
and let $\mathcal{I}{\left(M,P\right)}$ denote the value of the following integral for all $(M,P)$ where it converges and is real-valued:
$$\mathcal{I}{\left(M,P\right)}:=\frac{1}{\sqrt{2M}}\int_{0}^{\frac{1}{P}}\mathrm{d}t\,\frac{1}{\sqrt{G{\left(t\right)}}}.$$
Factoring the cubic:
We require $G{(t)}$ be nonnegative over the interval of integration $\left[0,\frac{1}{P}\right]$. Examining the values of the function at the endpoints, we quickly find $G{\left(\frac{1}{P}\right)}=0$ and
$$G{\left(0\right)}=\frac{P-2M}{2MP^{3}}\ge0\implies P\ge 2M.$$
It's not difficult to see that if $P=2M$, we would then have $G{\left(t\right)}<0$ for all $t\in\left(0,\frac{1}{P}\right)$. Hence, we require the strict inequality $P>2M$.
Setting $\Delta:=\left(P-2M\right)\left(P+6M\right)>0$ for convenience, the cubic $G$ can be factored as follows:
$$\begin{align}
G{\left(t\right)}
&=t^{3}-\frac{1}{2M}t^{2}+\frac{P-2M}{2MP^{3}}\\
&=\frac{2MP^{3}t^{3}-P^{3}t^{2}+P-2M}{2MP^{3}}\\
&=\frac{\left(Pt-1\right)\left[2MP^{2}t^{2}+\left(2M-P\right)Pt+2M-P\right]}{2MP^{3}}\\
&=\frac{\left(Pt-1\right)\left[4^{2}M^{2}P^{2}t^{2}+2\left(2M-P\right)4MPt+8M\left(2M-P\right)\right]}{4^{2}M^{2}P^{3}}\\
&=\frac{\left(Pt-1\right)\left[\left(4MPt\right)^{2}+2\left(4MPt\right)\left(2M-P\right)+8M\left(2M-P\right)\right]}{4^{2}M^{2}P^{3}}\\
&=\frac{\left(Pt-1\right)\left[\left(4MPt+2M-P\right)^{2}-\left(P-2M\right)\left(P+6M\right)\right]}{4^{2}M^{2}P^{3}}\\
&=\frac{\left(1-Pt\right)\left[\left(P-2M\right)\left(P+6M\right)-\left(P-2M-4MPt\right)^{2}\right]}{4^{2}M^{2}P^{3}}\\
&=\frac{\left(1-Pt\right)\left[\Delta-\left(P-2M-4MPt\right)^{2}\right]}{4^{2}M^{2}P^{3}}\\
&=\frac{\left(1-Pt\right)\left[\sqrt{\Delta}+\left(P-2M-4MPt\right)\right]\left[\sqrt{\Delta}-\left(P-2M-4MPt\right)\right]}{4^{2}M^{2}P^{3}}\\
&=\frac{\left(1-Pt\right)\left[\left(P-2M\right)+\sqrt{\Delta}-4MPt\right]\left[4MPt-\left(P-2M\right)+\sqrt{\Delta}\right]}{4^{2}M^{2}P^{3}}\\
&=\left(\frac{P-2M+\sqrt{\Delta}}{4MP}-t\right)\left(\frac{1}{P}-t\right)\left(t-\frac{P-2M-\sqrt{\Delta}}{4MP}\right).\\
\end{align}$$
Assuming $P>3M$, it can be shown that
$$\frac{P-2M+\sqrt{\Delta}}{4MP}>\frac{1}{P}>0>\frac{P-2M-\sqrt{\Delta}}{4MP}.$$
This also guarantees that the integral $\mathcal{I}{\left(M,P\right)}$ is real-valued and convergent.
Reduction of the elliptic integral to Legendre form:
For $(a,b,c,z)\in\mathbb{R}^{4}$ such that $a>b>z>c$, define the function $\mathcal{E}{\left(a,b,c,z\right)}$ by the elliptic integral
$$\mathcal{E}{\left(a,b,c,z\right)}:=\int_{z}^{b}\mathrm{d}t\,\frac{1}{\sqrt{\left(a-t\right)\left(b-t\right)\left(t-c\right)}},$$
and set
$$\varphi:=\arcsin{\left(\sqrt{\frac{z-c}{b-c}}\right)}\in\left(0,\frac{\pi}{2}\right),$$
$$\kappa:=\sqrt{\frac{b-c}{a-c}}\in(0,1).$$
Consider the transformation given by the substitution $\sqrt{\frac{t-c}{b-c}}=x$. Observing that
$$\sqrt{\frac{t-c}{b-c}}=x\implies t=c+\left(b-c\right)x^{2}\implies \frac{dt}{dx}=2\left(b-c\right)x,$$
we find after applying the substitution that $\mathcal{E}$ can be rewritten as
$$\begin{align}
\mathcal{E}{\left(a,b,c,z\right)}
&=\int_{z}^{b}\mathrm{d}t\,\frac{1}{\sqrt{\left(a-t\right)\left(b-t\right)\left(t-c\right)}}\\
&=\int_{\sqrt{\frac{z-c}{b-c}}}^{1}\mathrm{d}x\,\frac{2\left(b-c\right)x}{\sqrt{\left[a-c-\left(b-c\right)x^{2}\right]\left[b-c-\left(b-c\right)x^{2}\right]\left(b-c\right)x^{2}}}\\
&=\frac{2}{\sqrt{a-c}}\int_{\sqrt{\frac{z-c}{b-c}}}^{1}\mathrm{d}x\,\frac{1}{\sqrt{\left(1-x^{2}\right)\left[1-\left(\frac{b-c}{a-c}\right)x^{2}\right]}}\\
&=\frac{2}{\sqrt{a-c}}\int_{\sin{\left(\varphi\right)}}^{1}\mathrm{d}x\,\frac{1}{\sqrt{\left(1-x^{2}\right)\left(1-\kappa^{2}x^{2}\right)}}\\
&=\frac{2}{\sqrt{a-c}}\int_{\varphi}^{\frac{\pi}{2}}\mathrm{d}\tau\,\frac{1}{\sqrt{1-\kappa^{2}\sin^{2}{\left(\tau\right)}}};~~~\small{\left[x=\sin{\left(\tau\right)}\right]}\\
&=\frac{2}{\sqrt{a-c}}\left[K{\left(\kappa\right)}-F{\left(\varphi,\kappa\right)}\right],\\
\end{align}$$
where here the incomplete and complete elliptic integrals of the first kind are defined with the following argument convention:
$$F{\left(\theta,k\right)}:=\int_{0}^{\theta}\mathrm{d}\tau\,\frac{1}{\sqrt{1-k^{2}\sin^{2}{\left(\tau\right)}}};~~~\small{\theta\in\mathbb{R}\land k\in(-1,1)},$$
$$K{\left(k\right)}:=F{\left(\frac{\pi}{2},k\right)};~~~\small{k\in(-1,1)}.$$
From here, obtaining a final expression for $\mathcal{I}{\left(M,P\right)}$ is simply a matter of plugging-and-chugging!
As a parting gift, I refer you to this amazing set of lecture notes in case you want to know more about systematically reducing elliptic integrals. Cheers! ;)