A little terminology: The highest power of a prime $p$ that can divide some number $m$ is called the multiplicity (or less memorably the $p$-adic order) of $p$ in $m$, denoted $\nu_p(m)$.
For a general $k$ you would need to consider the prime factors of $k$ in turn and find which $\dfrac{\nu_{p_i}(m)}{\nu_{p_i}(k)}$ is the least.
One common question is to ask how many trailing zeroes there are on some factorial. Then $k=10$ with single prime factors $2$ and $5$.
To find $\nu_p(n!)$ is a particularly rapid evaluation. Effectively we are being asked to sum the mulitplicities of $p$ across all the values up to $n$, and of course many of these values are coprime to $p$ - in fact only $s_1:=\left\lfloor
\dfrac{n}{p} \right\rfloor$ values make any contribution. Then $s_2:=\left\lfloor \dfrac{n}{p^2} \right\rfloor=\left\lfloor \dfrac{s_1}{p} \right\rfloor$ have a second power of $p$ involved, and $s_3:=\left\lfloor \dfrac{n}{p^3} \right\rfloor=\left\lfloor \dfrac{s_2}{p} \right\rfloor$ have a third power of $p$, etc. So the simple process here is to repeatedly divide each term by the prime concerned until the term falls to zero.
For example, $\nu_2(555!) = 277+138+69+34+17+8+4+2+1 = 550$ and $\nu_5(555!) = 111+22+4 = 137$ so $555!$ has $137$ trailing zeroes.