Finding the minimum number of elements with sum above a threshold