2. Let $x, y$ be positive numbers, and $S$ be the smallest number among $x, y+\frac{1}{x}, \frac{1}{y}$. Find the maximum possible value of $S$. For what values of $x, y$ is this maximum value achieved?
(6th All-Soviet Union Olympiad)