const sizes = [1000, 750, 500]
const sum = 3000
function permutation(len, acc = []){
let res = []
sizes.forEach(s => {
let temp = null
if (s === len) {
res.push(acc.concat([s]))
} else if (s < len) {
temp = permutation(len-s, acc.concat([s]))
}
if (temp) {
res = res.concat(temp)
}
})
if (res.length) {
return res
}
}
const result = permutation(sum)
console.log(result)