Math doubt.....!

How did we go from (AB)%m-1 = 0
to , AB-1=k.m ?

we assumed that ab-1 is a multiple of m because if we took mod of the whole eqn (AB)%m-1 = 0 we d get 0
so we can say ab-1 =k*m