Answer
See work below.
Work Step by Step
To determine the procedure, we need to rely on the classification of 5 groups of cations to find the difference between $Mg^{2+}$ and $K^{+}$. $Mg^{2+}$ is a group 4 cation, which has an insoluble phosphate, while $K^{+}$ is a group 5 cation, which remains in the solution after adding the phosphates. Therefore, we are able to setup the procedure:
First, add ammonium hydrogen phosphate ($(NH_4)_2HPO_4$) and $NH_3$ to the solution; $MgNH_4PO_4$ would precipitate. Then, filtration of the solution will give us the filtrate consists largely $K^{+}$ ions, while the residue will be the mentioned precipitate.