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

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

ans=0

if n<=k:

    print((0))

else:

    hl.sort(reverse=True)

    temp=hl[(k+1)-1:n]

    for v in temp:

        ans+=v

    print(ans)

#n=int(input())

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

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

#l=[list(map(int,input().split())) for i in range(n)]



if n<=k:

    print((0))

else:

    l.sort(reverse=True)

    print((sum(l[k:n])))

n, k = list(map(int, input().split()))
hl = list(map(int, input().split()))
ans = 0
if n <= k:
    print((0))
else:
    hl.sort(reverse=True)
    temp = hl[(k + 1) - 1 : n]
    for v in temp:
        ans += v
    print(ans)

# n=int(input())
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
if n <= k:
    print((0))
else:
    l.sort(reverse=True)
    print((sum(l[k:n])))

+# n=int(input()) -hl = list(map(int, input().split())) -ans = 0 +l = list(map(int, input().split())) +# l=[list(map(int,input().split())) for i in range(n)] -    hl.sort(reverse=True) -    temp = hl[(k + 1) - 1 : n] -    for v in temp: -        ans += v -    print(ans) +    l.sort(reverse=True) +    print((sum(l[k:n])))