def solution(d, budget): d.sort() sum = 0 cnt = 0 for n in d: if(sum + n > budget): break sum += n cnt += 1 return cnt