\(M=x^2+y^2+xy-3x-3y+2018\)
\(=x^2+2x\frac{\left(y-3\right)}{2}+\left(\frac{y-3}{2}\right)^2+y^2-3y+2018-\left(\frac{y-3}{2}\right)^2\)
\(=\left(x+\frac{y-3}{2}\right)^2+\frac{3y^2-6y+8063}{4}\)
\(=\left(x+\frac{y-3}{2}\right)^2+\frac{3\left(y^2-2y+1\right)}{4}+2015\)
\(=\left(x+\frac{y-3}{2}\right)^2+\frac{3\left(y-1\right)^2}{4}+2015\ge2015\)
\("="\Leftrightarrow x=y=1\)