function solution(d, budget) { const arr = []; const ascendingD = d.sort((a, b) => a - b); for (let num of ascendingD) { budget -= num; if (budget >= 0) { arr.push(num); } else { return arr.length; } } return arr.length; }