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

if k>=n:

  print((0))

  exit()

h.sort(reverse=True)

for i in range(k):

  h[i]=0

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

if k>=n:

  print((0))

  exit()

h.sort()

print((sum(h[:n-k])))

n, k, *h = list(map(int, open(0).read().split()))
if k >= n:
    print((0))
    exit()
h.sort(reverse=True)
for i in range(k):
    h[i] = 0
print((sum(h)))

n, k, *h = list(map(int, open(0).read().split()))
if k >= n:
    print((0))
    exit()
h.sort()
print((sum(h[: n - k])))

-h.sort(reverse=True) -for i in range(k): -    h[i] = 0 -print((sum(h))) +h.sort() +print((sum(h[: n - k])))