You could try this:
Step 1.
Sort the bins by the amount of space available
The largest bin has index 0, the smallest bin has index Z
pick bins start from index 0, until the total space is either what you are looking for or you've got too much. If you've got the total you are looking for, stop. If not, carry on.
Step 2.
Let's say the last bin you picked is at index L (you've picked L+1 bins). Now starting from L descending, swap bins at index L-x with bins at index Z-x. By doing these swaps you are reducing the total. Stop swapping before the total is below what you are looking for. If you have a total that you were looking for, stop. Otherwise to step 3.
Step 3.
Let's say you've now picked the bins between index 0 and L-X and between Z and Z-X and the total is (slightly) above what you are looking for.
Now for each bin between 0 and L-X, find the best bin between index L-X+1 and Z-X-1 that you could swap it with to reduce the total so the total is exactly what you are looking for.
This algorithm is linear and gives you a great chance of finding a perfect set of bins.
I'd be interested to hear if this works for you.