Euclidean algorithm.
http://en.wikipedia.org/wiki/Euclidean_algorithm
$\lambda (n) = 780$
e=17, 780/17 nearest integer
17*45=765
780=17*45+15
17=15*1+2
15=2*7+1
7=1*7+0
now we got 1
Now applying back substitution
1 = 15 - 2*7
$\Rightarrow 15 - 7*(17-15*1)$
1=$15-7*17+15*7 \Rightarrow 8*(15)-7*17$
1=$8*(780-17*45)-7*17 \Rightarrow 8*(780)-367*(17)$
It is last step we got an equation 1=p(x)+q(y)
p=8 q=-367
taking q mod 780 = d
- 367 mod 780 = 413
It looks bit complicated and but keep practicing you will do it lot faster.