function [MB,indexS] = extraampB(MBI,lB)

gamma=zeros(1,length(MBI));
for i=1:lB    
    gamma(i)=(i/lB)*max(MBI(1,lB),0);
end

MB=MBI-gamma;

indexS = 0;
for i=1:lB   
    if MB(i)<=0
        indexS = i;
        break;
    end
end
if indexS == 0
    indexS = lB;
end


end