Fill values X from values Y

I'm trying to create an algorithm to fill some values X (e.g. 10,000, 50,000, 100,000) from another set of values Y (e.g. 2500, 5000, 10,000, 42,500, 27,500).

Aim: To get the highest total filling of values X.

Rules: Can't repeat any value Y. Any value X must be entirely filled to count.

I've tried to knapsack this but it doesn't work very well because it creates huge value arrays. Any ideas?

Edit for more clarity:

An array of values X (ValueX), and an array of values Y (ValueY). Fill each individual value from ValueX, using any combination of values from ValueY. Once a value from ValueY has been used, it cannot be reused.


Fill ValueX[0] (10,000)

You could use ValueY[2] (10,000) and that would fill it completely. However now ValueY[2] cannot be reused for future filling of any ValueX.

If you then tried to fill ValueX[1] (50,000), you could use ValueY[3] (42,500), ValueY[1] (5000) and ValueY[0] (2500), to get a total of 50,000. Now those values(3, 1, 0) from ValueY have also been used.