2. One day, Xiao Ming went to a fruit shop and weighed $x \mathrm{~kg}$ of apples $(x$ is an integer), and should have paid $y$ yuan according to the marked price, which is exactly equal to the sum of the face values of two of the five banknotes in his hand, totaling 20 yuan. At this moment, the shop owner weighed the remaining apples in the basket, which was $6 \mathrm{~kg}$, and said to Xiao Ming: “If you buy the rest as well, then you will pay a total of 10 yuan for all of them.” Xiao Ming calculated that this would be equivalent to 0.5 yuan cheaper per kilogram than the marked price, and agreed. Then $x=$ $\qquad$ ,$y=$ $\qquad$
2. $x=4, y=6$.

It is easy to know that the denominations of 5 RMB notes with a total face value of 20 yuan can only be 1 yuan, 2 yuan, 2 yuan, 5 yuan, 10 yuan, so $y=3,4,6,7$.

When $y=3$, $\frac{10}{x+6}=\frac{3}{x}-\frac{1}{2} \Rightarrow x^{2}+20 x-36=0$, this equation has no integer solutions;

When $y=4$, $\frac{10}{x+6}=\frac{4}{x}-\frac{1}{2} \Rightarrow x^{2}+18 x-48=0$, this equation has no integer solutions;

When $y=6$, $\frac{10}{x+6}=\frac{6}{x}-\frac{1}{2} \Rightarrow x^{2}+14 x-72=0$, solving gives $x_{1}=4, x_{2}=-18$ (discard);

When $y=7$, $\frac{10}{x+6}=\frac{7}{x}-\frac{1}{2} \Rightarrow x^{2}+12 x-84=0$, this equation has no integer solutions.
Therefore, $x=4, y=6$.