\(x^2+y^2+9+2xy+6x+6y+y^2-1=0\)
\(\Leftrightarrow\left(x+y+3\right)^2+y^2-1=0\Leftrightarrow\left(x+y+3\right)^2=1-y^2\le1\)
\(\Rightarrow-1\le x+y+3\le1\)
\(\Rightarrow-1+2013\le x+y+2016\le1+2013\)
\(\Rightarrow2012\le B\le2014\)
\(\Rightarrow B_{min}=2012\) khi \(\left\{{}\begin{matrix}1-y^2=1\\x+y+3=-1\end{matrix}\right.\) \(\Rightarrow\left\{{}\begin{matrix}y=0\\x=-4\end{matrix}\right.\)
\(B_{max}=2014\) khi \(\left\{{}\begin{matrix}1-y^2=1\\x+y+3=1\end{matrix}\right.\) \(\Rightarrow\left\{{}\begin{matrix}y=0\\x=-2\end{matrix}\right.\)