I'm not quite sure what you mean by
regardless of x and y being out of balance.
Surely it would make more sense to assume you gain 0 weight if x and y are balanced? The prime reason why people get obese is probably because x and y are not balanced for them (there are other reasons though, as well as reasons why people can have it imbalanced and still not gain weight).
- Even if you consume exactly as many calories as you expend in a day, you may gain weight depending on how (ratio of protein/fats/carbohydrates) and especially when you consume the calories. The body may for example store consumed amounts as fat after eating and then use carbohydrate storage from liver and muscle when starving, so long term you would still gain weight.
Adipose (fatty) tissue requires energy too. If you consume in the same manner after as before cutting a large amount of it away, you may just regain it until x=y again.
Also consider: if people ate just half an apple a day more than the exact amount of energy they need, they should gain more than a kilo on average every year. But they don't, and you can hardly assume that people manage on average to consume the exact amount their body needs.
The reason for that is probably leptin. It is a hormone produced by adipocytes (fat cells) and essentially indirectly reduces food uptake and increases expenditure, among others by decreasing your appetite. This has been regarded as a sort of "adipostat"; your leptin system creates a genetically determined level of body fat that you will tend to obtain. Dieting or cutting away fat will cause a drift to return to the previous weight because of a lower level of leptin (due to reduced fat cells). Of course it's not as simple as that though, so it's also possible that you will actually long-term reduce weight through those methods. E.g. exercise seems likely to be an exception somehow.