There are two questions here: One is about notation and the other one about the solution of a particular problem involving this notation.
(a) The symbol $\equiv$ implying some sort of "equality" or "equivalence" is used in everyday mathematics in two completely different frameworks. In analysis an "identity" of the form
$\sin^2 x +\cos^2 x\ \equiv\ 1$
conveys the meaning that the equation $\sin^2 x+\cos^2x =1$ is true for all values of the variable $x$ in the actual environment of discourse, say $\bigl[0,{\pi\over2}\bigr]$, ${\mathbb R}$, or ${\mathbb C}$.
In elementary number theory the symbol $\equiv$ in an equation only has a meaning in connection with an attribute "$(\bmod m)$" stated explicitly on the right of the equation. An equation of the form $x\equiv y \pmod m$ then means that $x-y$ is divisible by the integer $m$. One might as well write an $m$ below the $\equiv$-symbol.
It follows that in your example the symbol $\equiv$ means different things in the two given equations.
(b) Concerning the particular problem I refer to other answers to your question.