n,k,*h=list(map(int,open(0).read().split()))

h=sorted(h)[::-1]

for i in range(min(k,n)):h[i]=0

print((sum(h)))
n,k,*h=list(map(int,open(0).read().split()))

print((sum(sorted(h)[:n-min(n,k)])))
n, k, *h = list(map(int, open(0).read().split()))
h = sorted(h)[::-1]
for i in range(min(k, n)):
    h[i] = 0
print((sum(h)))

n, k, *h = list(map(int, open(0).read().split()))
print((sum(sorted(h)[: n - min(n, k)])))

-h = sorted(h)[::-1] -for i in range(min(k, n)): -    h[i] = 0 -print((sum(h))) +print((sum(sorted(h)[: n - min(n, k)])))