If $p$ is a factor of $m^2$ then $p$ is a factor of $m$ I'm a complete beginner and not sure where to go with this proof of Euclid's lemma. Any help would be greatly appreciated.

If $m$ is a positive integer and a prime number $p$ is a factor of $m^2,$ then  $p$ is a factor of $m.$

So far I have:
Since we know that $m$ is a positive integer, then $m^2$ must also be positive.
We also know that $p$ is positive integer, since it is a prime number.
So $m^2 = p*k$ where $k$ is positive since both $m^2$ and $p$ are positive.
Therefore, $k$ is greater than or equal to $1.$
...?

If $p$ is not a prime factor of $m$ then $gcd(p,m)=1$ since $p$ is prime. So there exists integers $x$ and $y$ such that
$$
xp + ym = 1
$$
So
$$
xmp = m - ym^2.
$$
Since $p \mid m^2$, this implies $p \mid m$. Contradiction.
