  Program Main

    Implicit None

    Integer, Allocatable :: H(:) 
    Integer(8)           :: i,j,N,K,s,dum

    N = 0 ; K = 0 ; s = 0
    Read(*,*) N,K
    Allocate (H(N)); H(:) = 0.0d0 
    Read(*,*)(H(i),i=1,N)

    Do i = 1,N-1
       Do j = i+1,N
          If (H(i) < H(j)) then
             dum  = H(i)
             H(i) = H(j)
             H(j) = dum
          Endif
       Enddo
    Enddo

    If (K < N) then
       Do i = K+1,N
          s = s + H(i)
       Enddo
    Endif

    Write(*,"(I0)") s
    Deallocate(H)

  End Program
