# -*- coding: utf-8 -*-

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

h = [int(i) for i in input().split()]



if k >= n:

    ans = 0

else:

    h.sort()

    tmp = 0

    for i in range(n-k, n):

        tmp += h[i]

    ans = (sum(h) - tmp)

print(ans)

# -*- coding: utf-8 -*-

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

h = [int(i) for i in input().split()]

"""

if k >= n:

    ans = 0

else:

    h.sort()

    tmp = 0

    for i in range(n-k, n):

        tmp += h[i]

    ans = (sum(h) - tmp)

print(ans)

"""



if k >= n:

    ans = 0

else:

    h.sort()

    ans = 0

    for i in range(n - k):

        ans += h[i]

print(ans)

# -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
if k >= n:
    ans = 0
else:
    h.sort()
    tmp = 0
    for i in range(n - k, n):
        tmp += h[i]
    ans = sum(h) - tmp
print(ans)

# -*- coding: utf-8 -*-
n, k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
"""
if k >= n:
    ans = 0
else:
    h.sort()
    tmp = 0
    for i in range(n-k, n):
        tmp += h[i]
    ans = (sum(h) - tmp)
print(ans)
"""
if k >= n:
    ans = 0
else:
    h.sort()
    ans = 0
    for i in range(n - k):
        ans += h[i]
print(ans)

+""" -    for i in range(n - k, n): +    for i in range(n-k, n): -    ans = sum(h) - tmp +    ans = (sum(h) - tmp) +""" +if k >= n: +    ans = 0 +else: +    h.sort() +    ans = 0 +    for i in range(n - k): +        ans += h[i] +print(ans)