This means that from the segments AK, CM and BP, you can make a triangle similar to this one. Consequently, the sides share the same ratio.
Then you can argue the rest in different ways.
The first method. By Cheva’s theorem $($see Problem 53856$)$, this is possible only when this ratio is 1.
The second method. Let
We denote by G the intersection point of the medians $AA_1$, $BB_1$ and $CC_1$ of the triangle ABC $($Figure 2$)$. Suppose that p $<$ 1/2. Then the intersection point of the segments AM and BK lies inside the triangle $AB_1G$, and the point of intersection of the segments CP and BK is inside the triangle $BC_1G$, which is impossible $($these points coincide by the condition$)$. Similarly, the case when p $>$ 1/2 is rejected. Therefore, p = 1/2.