Please mention in the beginning that x and y are integers. To solve for 2 variables, you need 2 equations, or rather 2 independent pieces of information. The fact that x and y are both integers is that critical missing piece of information that you casually assume in the middle of the solution.