import sys

import heapq

input = sys.stdin.readline



N, K = list(map(int, input().split()))



Hs = [-int(c) for c in input().split()]

heapq.heapify(Hs)



for _ in range(min(K, len(Hs))):

    heapq.heappop(Hs)



print((-sum(Hs)))

import sys



input = sys.stdin.readline



N, K = list(map(int, input().split()))



Hs = sorted(map(int, input().split()))



print((sum(Hs[:-K if K > 0 else len(Hs)])))
import sys
import heapq

input = sys.stdin.readline
N, K = list(map(int, input().split()))
Hs = [-int(c) for c in input().split()]
heapq.heapify(Hs)
for _ in range(min(K, len(Hs))):
    heapq.heappop(Hs)
print((-sum(Hs)))

import sys

input = sys.stdin.readline
N, K = list(map(int, input().split()))
Hs = sorted(map(int, input().split()))
print((sum(Hs[: -K if K > 0 else len(Hs)])))

-import heapq -Hs = [-int(c) for c in input().split()] -heapq.heapify(Hs) -for _ in range(min(K, len(Hs))): -    heapq.heappop(Hs) -print((-sum(Hs))) +Hs = sorted(map(int, input().split())) +print((sum(Hs[: -K if K > 0 else len(Hs)])))