Straight line is tangent to the curve. The straight line $y=mx+1$ is tangent to the curve $x^2+y^2-2x+4y=0$. Find the possible values of $m$.
My attempt

Substitute the $y=mx+1$ into the equation $x^2+y^2-2x+4y=0$. $$x^2+(mx+1)^2-2x+4(mx+1)=0$$ $$x^2+m^2x^2+2mx+1-2x+4mx+4=0$$ $$(1+m^2)x^2+6mx-2x+5=0$$ $$(1+m^2)x^2+(6m-2)x+5=0$$
I think what I did is wrong as I don't know how to continue from my steps. Can anyone explains it? Thanks

Hint: Differentiating implicitly yields $$2x + 2y \frac{\mathrm{d}y}{\mathrm{d}x} - 2 + 4\frac{\mathrm{d}y}{\mathrm{d}x} = 0 \iff \frac{\mathrm{d}y}{\mathrm{d}x} = \frac{1-x}{y+2}$$ 
What can you say about gradient of tangent lines and derivatives of functions? 
