module subprogs
    implicit none
    contains
    subroutine bubble_sort(n,L)
      integer,intent(in) :: n
      integer,intent(inout) :: L(n)
      integer :: i,j 
      integer :: t
      do i = 1,n-1
         do j = i + 1,n
            if (L(i) .gt.L(j)) then
               t = L(i)
               L(i) = L(j)
               L(j) = t
  !             print*,L
            end if
         end do
       end do
    end subroutine bubble_sort
  end module subprogs

program fennec_monster
use subprogs
implicit none
integer :: n,k,i
integer(8) :: Dsum 
integer,allocatable :: h(:)
Dsum = 0
read(*,*) n,k
allocate(h(n))
read(*,*) h(:)
call bubble_sort(n,h)
!print*,h(:)
if (n -k > 0)then

    do i = 1 ,n-k
        Dsum = Dsum + h(i)
    end do
end if

    write(*,*) Dsum
end program fennec_monster