Find all solutions for $x$ mod $777$ Solve $123x \equiv 321\pmod{777}$


$\gcd(123,777) = 3$ so solution exists. Then
$123x = 321 + 777k$.

$$41x = 107 + 259k\implies 41x \equiv 107\pmod{259} $$

What i need to do next?
You need to solve the Diophantine equation $$41x+259k=107$$ Note that I have made the sign positive to make the calculations easier. This is allowed as $k$ is an integer.

Now use the Euclidean Algorithm:

$$259=6\cdot41+13\\41=3\cdot13+2\\13=6\cdot2+1$$ and you can work back to solve for $x$ and $k$.
Picking up where @The Simplifire left off:  $\begin{align}1=13-6\cdot2, 1=13-6(41-3\cdot{13}), 1=19\cdot{13}-6\cdot{41},1=19(259-6\cdot{41})-6\cdot{41}, 1=-120\cdot{41}+19\cdot{259}\end{align}$. 
Thus, $107\cdot{-120}=-12840$ and $107\cdot{19}=2033$, gives an initial solution...

All the other solutions are of the form $(-12840+m\cdot{259} ,2033-m\cdot{41})$.

Since you are interested in $x$, we get $x=-12840+m\cdot{259}$.