So far I got:
$7\alpha \equiv 1$ mod $\phi(6161)$
$\phi(6161) = \phi(61) \times \phi(101) = 6000$
$7\alpha \equiv 1$(mod $6000)$
At this point we are supposed to do euclid's algorithm and somehow arrive at:
$D: x\to x^{5143}$ mod $6161$
I don't understand the euclid step