Help in this question please. Media.net hiring round

A bus stops at n bus stops, each bus stop having a[i] people. The bus needs to take in all the people on the bus. People from 1 bus stop get down before the next bus stop arrives. They use a resizing tech which allows the bus to be resized to whatever capacity they want. This action can be done only b times at max. The uselessness of the bus is the summation of a total number of unoccupied seats across n stops. Find the minimum uselessness the bus can achieve if the resizing tech is used optimally. 1<=a[i]<=10^6, 1<=b<=n<=400

Source - Media.net Interview Experience 2021 - GeeksforGeeks