n,k=list(map(int,input().split()))

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

s=sorted(h,reverse=True)

cnt=0

for i in range(n):

    cnt+=s[i]

if k>=n:

  print((0))

  exit()

else:

  for i in range(k):

    cnt-=s[i]

print(cnt)
n,k=list(map(int,input().split()))

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

s=sorted(h)

s.reverse()

print((sum(s[k:])))
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
s = sorted(h, reverse=True)
cnt = 0
for i in range(n):
    cnt += s[i]
if k >= n:
    print((0))
    exit()
else:
    for i in range(k):
        cnt -= s[i]
print(cnt)

n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
s = sorted(h)
s.reverse()
print((sum(s[k:])))

-s = sorted(h, reverse=True) -cnt = 0 -for i in range(n): -    cnt += s[i] -if k >= n: -    print((0)) -    exit() -else: -    for i in range(k): -        cnt -= s[i] -print(cnt) +s = sorted(h) +s.reverse() +print((sum(s[k:])))