program main
   implicit none
   integer i,n,k,hmax_loc(1)
   integer(8),allocatable :: h(:)
   
   read(*,*) n,k
   allocate(h(n))
   read(*,*) (h(i),i=1,n)
   do i=1,k
      hmax_loc=maxloc(h)
      h(hmax_loc(1))=0
   end do
   write(*,'(i0)') sum(h)
end program main

