I am trying to simplified the following expression: $$\left(y^m\right)^{x} \bmod p$$
In my case, I can only solve $(y^x) \bmod p$ first without prior knowledge of $m$. Eventually, my answer should derive at $(y^m)^{x} \bmod p$.
For example, $y^x \times g^m \bmod p = (y^x \bmod p \times g^m\bmod p ) \bmod p$
So I am asking, is there a way to simplify $(y^m)^{x} \bmod p$ like what I did for the above.