The time complexity of computing $MK\bmod P$ is $O((\log n)^2)$.  What is the time complexity of computing $MK^2\bmod P$? Is it $O(2(\log n)^2)$ or $O((\log n)^2)$?
Time complexity for two multiplications modulo $p$
complexity theory;time complexity