This function returns true if the value cumulative according to received integer K is less than budget B , otherwise returns false
bool canBeOptimalValue ( int K , int arr [ ] , int N , int B , int & value ) {