This function returns true if the value cumulative according to received integer K is less than budget B , otherwise returns false
let cumulativeValue = 0 ; function canBeOptimalValue ( K , arr , N , B ) {