Help for codigo HELP problem

i have tried this solution but getting WA : CodeChef: Practical coding for everyone
fot question : AKA2 Problem - CodeChef

i am doing
a ) if current values is less then previous element the we can take current value as section
otherwise take the difference a[i] - a[i-1] in another array, sort that array , take last x section then
take firt some section while k >0

can any body help where my code is failing please ?