2. If $\sin x+\sin y=1$, then the range of $\cos x+\cos y$ is ( ).
(A) $[-2,2]$
(B) $[-1,1]$
(C) $[0, \sqrt{3}]$
(D) $[-\sqrt{3}, \sqrt{3}]$
2.D.

Let $\cos x+\cos y=t$, then
$$
\begin{array}{l}
\cos ^{2} x+2 \cos x \cdot \cos y+\cos ^{2} y=t^{2} . \\
\text { Also } \sin x+\sin y=1 \text {, so } \\
\sin ^{2} x+2 \sin x \cdot \sin y+\sin ^{2} y=1 .
\end{array}
$$

Therefore, $2(\cos x \cdot \cos y+\sin x \cdot \sin y)=t^{2}-1$, that is
$$
2 \cos (x-y)=t^{2}-1 \text {. }
$$

Since $-1 \leqslant \cos (x-y) \leqslant 1$, we have $t^{2} \leqslant 3$, that is
$$
-\sqrt{3} \leqslant t \leqslant \sqrt{3} \text {. }
$$