def solve():

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

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

  if K>=N:

    return 0

  H.sort()

  ans = sum(H[:N-K])

  return ans

print((solve()))
def solve():

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

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

  H.sort()

  ans = sum(H[:max(N-K,0)])

  return ans

print((solve()))
def solve():
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))
    if K >= N:
        return 0
    H.sort()
    ans = sum(H[: N - K])
    return ans


print((solve()))

def solve():
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))
    H.sort()
    ans = sum(H[: max(N - K, 0)])
    return ans


print((solve()))

-    if K >= N: -        return 0 -    ans = sum(H[: N - K]) +    ans = sum(H[: max(N - K, 0)])