while reading the el gamal signature scheme , i came across the following steps:

1. select a random k such that gcd ( k, phi(p) )=1 where p is a prime number

2. compute r= (alpha) ^ k (mod p) where ( 0<r<p)

3. compute s= k^-1 (m - ar) (mod (phi(p))

i do not understand why the steps keep on changing the modulus to work in? I have found the same thing happening in many of other signature functions and asymmetric encryption function.

please help thank you