I want to calculate the time complexity of two encryption and decryption algorithms. The first one (RSA-like) has the encryption $$ C := M^e \bmod N $$ and decryption $$ M_P := C^d \bmod N. $$ Assuming $n = \log N$, $m = \log e$ and $k = \log d$, I think they have time complexities $O(n^2 · m)$ and $O(n^2 · k)$, respectively. Are these two complexities same? I also have another pair of algorithms, with $$ C := M · k \bmod N $$ and $$ M_P := C · k^{-1} \bmod N.$$ How does the calculation of the modular inverse $k^{-1} \bmod N$ contribute to the time complexity?