N, K = list(map(int, input().split()))

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



Hs.sort(reverse=True)



ans = sum(Hs) - sum(Hs[:K])



print(ans)

N, K = list(map(int, input().split()))

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



Hs.sort(reverse=True)



ans = sum(Hs[K:])

print(ans)

N, K = list(map(int, input().split()))
Hs = list(map(int, input().split()))
Hs.sort(reverse=True)
ans = sum(Hs) - sum(Hs[:K])
print(ans)

N, K = list(map(int, input().split()))
Hs = list(map(int, input().split()))
Hs.sort(reverse=True)
ans = sum(Hs[K:])
print(ans)

-ans = sum(Hs) - sum(Hs[:K]) +ans = sum(Hs[K:])