# Values of $d$ in a congruence problem $dp \equiv s \mod N$

I'm solving an algorithm problem and it boils down to solving the congruency $$dp \equiv s \mod N$$ for the smalest value of $d$. Is there a way I can use number theory to solve this?

-

Your congruence will have a solution if and only if $\gcd(p,\ N)=g| s$ and there will be $g$ solutions modulo $N$.