import heapq



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

H = list(map(int, input().split()))



minus_H = [i * (-1) for i in H]

heapq.heapify(minus_H)



for i in range(min(N, K)):

    heapq.heappop(minus_H)



ans = - sum(minus_H)



print(ans)

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

H = list(map(int, input().split()))



H.sort(reverse = True)



if K >= N:

    ans = 0

else:

    ans = sum(H[K:])



print(ans)

import heapq

N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
minus_H = [i * (-1) for i in H]
heapq.heapify(minus_H)
for i in range(min(N, K)):
    heapq.heappop(minus_H)
ans = -sum(minus_H)
print(ans)

N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)
if K >= N:
    ans = 0
else:
    ans = sum(H[K:])
print(ans)

-import heapq - -minus_H = [i * (-1) for i in H] -heapq.heapify(minus_H) -for i in range(min(N, K)): -    heapq.heappop(minus_H) -ans = -sum(minus_H) +H.sort(reverse=True) +if K >= N: +    ans = 0 +else: +    ans = sum(H[K:])