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

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



if n <= k:

  print((0))

else:

  h.sort()

  ans = 0

  for i in range(n-k):

    ans += h[i]

  print(ans)

import sys



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



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



h.sort()



if k >= n:

  print((0))

  sys.exit()



h = h[:n-k]



print((sum(h)))

n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
if n <= k:
    print((0))
else:
    h.sort()
    ans = 0
    for i in range(n - k):
        ans += h[i]
    print(ans)

import sys

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

+import sys + -if n <= k: +h.sort() +if k >= n: -else: -    h.sort() -    ans = 0 -    for i in range(n - k): -        ans += h[i] -    print(ans) +    sys.exit() +h = h[: n - k] +print((sum(h)))