function solution(people, limit) {
var sum = 0;
var len = people.length;
people.sort((a, b) => a - b);
while (people.length != 0) {
var s2 = people.pop();
var s1 = people[0];
if (s1 + s2 <= limit && s1 != undefined) {
people.splice(0, 1);
sum++;
}
}
return len - sum;
}