@tb_g_23 these things.
You will have to come up with a definition of what constitutes a removal. Is it based on duplicate entries if so what are the criteria to remove them and which entry to keep (latest one, first one). This might require a window and rank function.
If it is the sum of costs that should fit you could try a recursive loop to combine your items until the sum is reached or you have the smallest absolute deviation from your target sum.