If the sum of the numbers in the list1 is not 4000, it should give the closest value to 4000. The maximum number of elements of the output is 6.
For example
Sum =