program example
	implicit none

	integer(8) :: N,K,i,wa=0,j,kari
    integer(8),allocatable :: H(:)
    
    read(*,*) N,K
    
    allocate(H(N))
    
    read(*,*) H(:)
    
    if (K==0) then
    	goto 1
    end if
    
    do i=1,N
    	do j=i+1,N
        
        	if(H(j)>=H(i)) then
            	kari=H(i)
            	H(i)=H(j)
                H(j)=kari
                
            end if
        
        end do
    end do
   
1   	write(*,*) sum(H(K+1:))
    
end program example