function simulate(input, numDays) {
const totals = [0, 0, 0, 0, 0, 0, 0, 0, 0];
input.forEach((f) => {
totals[f]++;
});
for (let day = 0; day < numDays; day++) {
const newBirths = totals[0];
for (let i = 0; i < 8; i++) {
totals[i] = totals[i + 1];
}
totals[8] = newBirths;
totals[6] += newBirths;
}
return AOC.sum(totals);
}