Problem:
 Score : 300 points    Problem Statement Fennec is fighting with N monsters.  The health of the i -th monster is H_i .  Fennec can do the following two actions:   Attack: Fennec chooses one monster. That monster's health will decrease by 1 .  Special Move: Fennec chooses one monster. That monster's health will become 0 .   There is no way other than Attack and Special Move to decrease the monsters' health.  Fennec wins when all the monsters' healths become 0 or below.  Find the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.      Constraints  1 \leq N \leq 2 \times 10^5  0 \leq K \leq 2 \times 10^5  1 \leq H_i \leq 10^9  All values in input are integers.         Input Input is given from Standard Input in the following format:  N  K  H_1  ...  H_N       Output Print the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.        Sample Input 1 3 1
4 1 5      Sample Output 1 5  By using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.       Sample Input 2 8 9
7 9 3 2 3 8 4 6      Sample Output 2 0  She can use Special Move on all the monsters.       Sample Input 3 3 0
1000000000 1000000000 1000000000      Sample Output 3 3000000000  Watch out for overflow.

Solution (Python):
n,k = map(int,input().split())
h = list(map(int,input().split()))

h.sort()
k = min(n,k)
for _ in range(k):
    h.pop()

print(sum(h))

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
s = sum(H[K:])
print(s)

Solution (Python):
n,k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
if n <= k:
    print(0)
else:
    print(sum(h[:n-k]))

Solution (Python):
n, k = map(int,input().split(" "))
nl = list(map(int,input().split(" ")))
nl.sort()

for i in range(k):
  if not nl:
    break
  else:
  	nl.pop()
if not nl:
  print("0")
else:
  print(sum(nl))

Solution (Python):
N, K = map(int, input().split())
H = map(int, input().split())
if K >= N:
    print(0)
    exit()

H = list(H)
H.sort()
print(sum(x for x in H[0 : N - K]))

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

Solution (Python):
N,K=map(int,input().split())
H=sorted(list(map(int,input().split())))

if N<=K:
    print(0)
else:
    if K==0:
        print(sum(H))
    else:
        print(sum(H[:-K]))

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

Solution (Python):
def mapt(fn, *args):
    return tuple(map(fn, *args))

def main():
    n, k = mapt(int, (input().split(" ")))
    a = sorted(mapt(int, input().split(" ")))
    if k >= len(a): print(0); exit()
    while k > 0:
        a.pop()
        k -= 1
    print(sum(a))
    
main()

Solution (Python):
n, k = map(int , input().split())
hn = [int(num) for num in input().split()]

hn.sort(reverse = True)
if len(hn) > k:
  print(sum(hn[k:]))
else :
  print(0)

Solution (Python):
number = list(map(int,input().split()))
score = list(map(int,input().split()))
score.sort()
answer = 0
if number[1] > number [0]:
    number[1] = number[0]
for i in range(number[1]):
    score[number[0]-1-i] = 0
for j in range(number[0]):
    answer += score[j]
print(answer)

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N,K = LI()
    H = sorted(LI(),reverse=True)
    H_removed = H[K:]
    print(sum(H_removed))


main()

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N,K = LI()
    H = sorted(LI(),reverse=True)
    H_removed = H[K:]
    print(sum(H_removed))


main()

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

Solution (Python):
n,k = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
print(sum(H[k:]))

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))

h.sort(reverse=True)

if k>n:
  k=n

for i in range(k):
  h[i]=0

sum_=0
for hh in h:
  sum_+=hh
print(sum_)

Solution (Python):
import sys

N, K = map(int, next(sys.stdin.buffer).split())
H = list(map(int, next(sys.stdin.buffer).split()))

if K:
  H.sort()
  print(sum(H[:-K]))
else:
  print(sum(H))

Solution (Python):
import sys

N, K = map(int, sys.stdin.readline().rstrip().split())
H = [int(x) for x in sys.stdin.readline().rstrip().split()]

H.sort()

if K == 0:
    print(sum(H))
else:
    print(sum(H[:-K]))

Solution (Python):
a,b=map(int,input().split())
l=list(map(int,input().split()))
z=0
l=sorted(l)
for i in range(a-b):
  z+=l[i]
print(z)

Solution (Python):
a,b=map(int,input().split())
l=sorted(list(map(int,input().split())))
z=0
for i in range(a-b):
  z+=l[i]
print(z)

Solution (Python):
N, K = list(map(lambda n: int(n), input().split(" ")))
HP = list(map(lambda hp: int(hp), input().split(" ")))
HP.sort(reverse=True)

if K >= len(HP):
  print(0)
else:
  print(sum(HP[K:]))

Solution (Python):
n,k=map(int,input().split())
h=sorted(list(map(int,input().split())),reverse=True)
if n<=k:
    print("0")
else:
    print(sum(h[k:]))

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))

sort_H = sorted(H, reverse=True)

ans = sum(sort_H[K:])

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
ins = lambda: input().rstrip()
ini = lambda: int(input().rstrip())
inm = lambda: map(int, input().split())
inl = lambda: list(map(int, input().split()))

n, k = inm()
a = sorted(inl())
print(sum(a[:n-k]) if n > k else 0)

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n,k = inpm()
H = inpl()

H.sort()
H.reverse()

print(sum(H[k:]))

Solution (Python):
n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
print(sum(H[k:]))

Solution (Python):
N, K = map(int, input().split())
H = sorted(map(int, input().split()))[:max(0, N-K)]
print(sum(H))

Solution (Python):
if __name__ == '__main__':
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    H = sorted(H)[::-1]
    cnt = 0
    for h in H:
        if K>0:
            K -= 1
        else:
            cnt += h
    
    print(cnt)

Solution (Python):

N,K =map(int,input().split())
M_List = sorted(list(map(int,input().split())))
if K == 0:
    print(sum(M_List))
elif N<=K:
    print(0)
else:
    print(sum(M_List[:K*(-1)]))

Solution (Python):
a,b=map(int,input().split())
A=[int(x) for x in input().split()]
A.sort()
if a>=b:
  print(sum(A[:(a-b)]))
else:
  print(0)

Solution (Python):
N,K = map(int,input().split())
H = list(map(int,input().split()))
H = sorted(H)[::-1]
H = H[K:N]
print(str(sum(H)))

Solution (Python):
n, k = map(int, input().split())
h = sorted(list(map(int, input().split())), reverse=True)

print(sum(h[k:]))

Solution (Python):
N, K = map(int, input().split())
H = sorted(map(int, input().split()), reverse=True)
ans = sum(H[K:])
print(ans)

Solution (Python):
n, m = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
m = min(n, m)
while m > 0:
	arr.pop()
	m -= 1
ans = 0
for x in arr:
	ans += x
print(ans)

Solution (Python):


from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, K: int, H: "List[int]"):
    return sum(sorted(H)[:-K]) if K != 0 else sum(H)


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    H = [int(next(tokens)) for _ in range(N)]  
    print(f'{solve(N, K, H)}')


if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))
if n<=k:
  print(0)
  exit()
h.sort()
if k==0:
  print(sum(h))
else:
  print(sum(h[:-k]))

Solution (Python):
n,k,*hh = map(int, open(0).read().split())

hh.sort(reverse=True)

print(sum(hh[k:]))

Solution (Python):
n,k = map(int,input().split())
P = list(map(int,input().split()))

c=0
P.sort( reverse=True )

if k>len(P):
    k=len(P)
for i in range(k):
    c+=1    

ans = sum(P[c:])

print(ans)

Solution (Python):
n,k = map(int,input().split())
h = [int(s) for s in input().split()]
h.sort(key=int)
for _ in range(min(k,len(h))):del h[-1]
print(sum(h))

Solution (Python):
n,k=list(map(int,input().split()))
h=sorted(list(map(int,input().split())),reverse=True)

print(sum(h[k:]))

Solution (Python):
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())),reverse = True)
print(sum(H[K:]))

Solution (Python):
n,k=map(int,input().split())
energy=sorted(list(map(int,input().split())),reverse=True)
print(sum(energy[k:]))

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))

if N <= K:
    print(0)
else:
    H = sorted(H)
    ans = 0
    for i in range(N-K):
        ans += H[i]
    print(ans)

Solution (Python):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
for i in range(min(k,len(h))):
    h[i]=0
print(sum(h))

Solution (Python):
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())))
if(K == 0):
    print(sum(H))
else:
    print(sum(H[:-K]))

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
if n<=k:
  print(0)
  exit()
  
for i in range(k):
  h[i]=0
print(sum(h))

Solution (Python):
def resolve():
    N, K = list(map(int, input().split()))
    H = sorted(list(map(int, input().split())))
    print(0 if N<=K else sum(H[:N-K]))

if '__main__' == __name__:
    resolve()

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

Solution (Python):
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))[::-1]
print(sum(H[K:]))

Solution (Python):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h = sorted(h,reverse = True)

h1 = h[k:n]
print(sum(h1))

Solution (Python):
n,k=map(int,input().split())
h=[int(x) for x in input().rstrip().split()]
h.sort(reverse=True)

for i in range(min(k,n)):
  h[i]=0
print(sum(h))

Solution (Python):
import sys


def solve(n, k, h):
    if n <= k:
        return 0
    else:
        return sum(h[: n - k])


def main():
    input = sys.stdin.buffer.readline
    n, k = map(int, input().split())
    h = sorted(list(map(int, input().split())))
    print(solve(n, k, h))


if __name__ == "__main__":
    main()

Solution (Python):
n, k = map(int, input().split())
H = [int(i) for i in input().split()]

if len(H) <= k:
    ans = 0
else:
    H.sort()
    r = H
    if k != 0:
        r = H[:-k]
    ans = sum(r)

print(ans)

Solution (Python):
n, k = map(int, input().split())
h = [int(i) for i in input().split()]
new_h = sorted(h)[:n - k]
if n > k:
    print(sum(new_h))
else:
    print(0)

Solution (Python):
N,K = map(int,input().split())
H = list(map(int,input().split()))

H = sorted(H)

if N < K:
    K = N

for i in range(K):
    del[H[-1]]

print(sum(H))

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

Solution (Python):
N,K=map(int,input().split())
List = list(map(int, input().split()))
List.sort(reverse = True)
res = 0
for i in range(N):
  if i <= K-1:
    pass
  else:
    res += List[i]
print(res)

Solution (Python):
import math
from math import gcd
INF = float("inf")

import sys
input=sys.stdin.readline
import itertools
from collections import Counter

def main():
    n,k = map(int, input().split())
    h = list(map(int, input().split()))
    h.sort()
    if k == 0:
        print(sum(h))
    else:
        h = h[:-k]
        print(sum(h))


if __name__=="__main__":
    main()

Solution (Python):
n,k=map(int,input().split())
*h,=sorted(map(int,input().split()),reverse=1)
for i in range(min(k,n)):
    h[i]=0
print(sum(h))

Solution (Python):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l.sort()

if k != 0:
  del l[-k:]
print(sum(l))

Solution (Python):
N,K=map(int,input().split())
*H,=map(int,input().split())
H=sorted(H, reverse=True)
print(sum(H[K:]))

Solution (Python):
def solve():
    N,K = [int(i) for i in input().split()]
    H = [int(i) for i in input().split()]

    if K >= len(H):
        print('0')
    else:
        sorted_H = sorted(H)
        alived = N - K
        print(sum(sorted_H[:alived]))

if __name__ == "__main__":
    solve()

Solution (Python):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort()
for i in range(min(n,k)):
    h.pop()
print(sum(h))

Solution (Python):
n,k = map(int, input().split())
a = [int(i) for i in input().split()]
a.sort()
a.reverse()


if n <= k:
  print(0)
else:
  del a[0:k]
  print(sum(a))

Solution (Python):
def solve():
    n, k = map(int, input().split())
    s = list(map(int, input().split()))
    s.sort(reverse=True)
    if k >= n:
        print(0)
        exit()
    else:
        print(sum(s[k:]))


solve()

Solution (Python):
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort()
for _ in range(min(N,K)): H.pop()
print(sum(H))

Solution (Python):
n, k = map(int, input().split())
h = sorted(map(int, input().split()))
print([0, sum(h[: n - k])][n > k])

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

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)

print(sum(H[K:]))

Solution (Python):
n,k = map(int,input().split())

h = [0 for _ in range(n)]
h = [int(s) for s in input().split()]

h.sort()

if(n-k <= 0):
  ans = 0
else:
  h_new = h[:n-k]
  
  ans = sum(h_new)

print(ans)

Solution (Python):
n, k = map(int, input().split())
hp = sorted(list(map(int, input().split())))
for _ in range(min(len(hp), k)):
    del hp[-1]
print(sum(hp))

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))
print(sum(sorted(h)[::-1][k:]))

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))
print(sum(sorted(h)[:max(0, n - k)]))

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

Solution (Python):
N,K = map(int,input().split())

a = sorted(list(map(int,input().split())),reverse=True)
del a[0:K]
print(sum(a))

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort(reverse=True)
print(sum(h[k:]))

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)

if k > n:
    print(0)
else:
    print(sum(h[k:]))

Solution (Python):

def solve():
    H.sort()

    if K == 0:
        print(sum(H))
    else:
        print(sum(H[0:-K]))


if __name__ == "__main__":
    N,K = list(map(int, input().split()))
    H = list(map(int, input().split()))
    solve()

Solution (Python):
N,K=map(int,input().split())
H=sorted(list(map(int,input().split())),reverse=True)
H=H[K:]
ans=0
if K<N:
  for x in H:
    ans+=x
print(ans)

Solution (Python):
a,b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
c=sorted(c,reverse=True)
d=sum(c)
for i in range(0,len(c)):
    if(b>0):
        d=d-c[i]
        b=b-1
    else:
        break
print(d)

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))
sum=0
h.sort()
h=h[:n-k]

if n <= k:
    print(0)
    exit()
else:
    for i in h:
        sum += i
print(sum)

Solution (Python):
n,k = map(int,input().split())
h = sorted(map(int,input().split()),reverse=True)
print(sum(h[k:]))

Solution (Python):
def fennec_vs_monster():
    
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    
    H.sort(reverse=True)
    
    H = H[K:]
    
    sum_H = sum(H)
    
    return sum_H

result = fennec_vs_monster()
print(result)

Solution (Python):
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
reversed(H)
for i in range(K):
  if len(H)==0:
    break
  else:
    H.pop()
if len(H)==0:
  print(0)
else:
  print(sum(H))

Solution (Python):
N,K = map(int,input().split())
Hli = list(map(int,input().split()))

Hli.sort(reverse = True)
res = 0

for i in range(K,N):
  res += Hli[i]

print(res)

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
ans = sum(h[k:])
print(ans)

Solution (Python):
def readinput():
    n,k=map(int,input().split())
    h=list(map(int,input().split()))
    return n,k,h

def main(n,k,h):
    if k>=n:
        return 0
    
    h.sort(reverse=True)
    ans=0
    for i in range(k,n):
        ans+=h[i]
    return ans

if __name__=='__main__':
    n,k,h=readinput()
    ans=main(n,k,h)
    print(ans)

Solution (Python):
N,K=map(int,input().split())
H=list(map(int, input().split()))

H=sorted(H)
if K>=len(H):
  print(0)
else:
  for i in range(0,K):
    del H[-1]
  result=sum(H)
  print(result)

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N, K = read_ints()
    H = read_ints()
    if K >= N:
        return 0
    H.sort(reverse=True)
    return sum(H[K:])


if __name__ == '__main__':
    print(solve())

Solution (Python):
n,k=input().split()
n=int(n)
k=int(k)

arr=list(map(int,input("\r").strip().split()))[:n] 
arr.sort()
sum=0;
for i in range(0,n-k):
  
    sum+=arr[i]
  
print(sum)

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

Solution (Python):
import sys
input = sys.stdin.buffer.readline
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

n, k = MAP()
h = LIST()
h.sort(reverse=True)

if k >= n:
    print(0)
else:
    print(sum(h[k:]))

Solution (Python):



























































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    
    N, K = list(map(int, lines[0].split()))
    values = list(map(int, lines[1].split()))
    
    
    
    
    
    
    

    if K >= N:
        result = 0
    else:
        values.sort()
        values = values[::-1]
        for k in range(K):
            values[k] = 0
        result = sum(values)

    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3 1', '4 1 5']
        lines_export = [5]
    if pattern == 2:
        lines_input = ['8 9', ' 7 9 3 2 3 8 4 6']
        lines_export = [0]
    if pattern == 3:
        lines_input = ['3 0', '1000000000 1000000000 1000000000']
        lines_export = [3000000000]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

Solution (Python):
def solve():
  N, K = 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())

Solution (Python):




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


h.sort()
h.reverse()
ans = 0

for i in range(n):
    
    if i < k:
        continue
    else:
        ans = ans + h[i]


print(ans)

Solution (Python):



from fractions import gcd
from itertools import combinations,permutations,accumulate 

from collections import deque,defaultdict,Counter
import decimal
import re












import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n,k = readInts()
H = sorted(readInts(),reverse=True)
if n <= k:
    print(0)
else:
    print(sum(H[k:]))

Solution (Python):
n,k = map(int, input().split())
H = sorted(list(map(int, input().split())))[::-1]
ans = 0
for h in H:
    if k>0:
        k -= 1
        continue
    ans += h
print(ans)

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n, k = inm()
H = inl()
H.sort()


def solve():
    if k >= n:
        return 0
    return sum(H[: n - k])


print(solve())

Solution (Python):
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())),reverse=True)
print(sum(H[K:]))

Solution (Python):
n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
print(sum(H[k:]))

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))

    H.sort()
    if K == 0:
        ans = sum(H)
    else:
        ans = sum(H[:-K])

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()

if n <= k:
    ans = 0
else:
    ans = sum(h[:n-1*k])

print(ans)

Solution (Python):
n, k = map( int, input().split() )
h = list( map( int, input().split() ) )

h.sort()
print( sum( h[ : max( n - k, 0 ) ] ) )

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import itertools

n,k = [int(x) for x in stdin.readline().rstrip().split()]
h = [int(x) for x in stdin.readline().rstrip().split()]

if k<n:
    h.sort()
    print(sum(h[:n-k]))
else:
    print(0)

Solution (Python):
N,K = map(int, input().split())
H = list(map(int, input().split()))
a = sorted(H,reverse=True)
if(K>0):
  for i in range(min(K,N)):
    a[i]=0
print(sum(a))

Solution (Python):
n,k = map(int,input().split())
h = list(map(int,input().split()))

h.sort(reverse=True)

print(sum(h[k:]))

Solution (Python):
n, k = map(int, input().split())
H = sorted(list(map(int, input().split())))[::-1]
print(sum(H[k:]))

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
if 0 < K < N:
    print(sum(H[:-K]))
elif K == 0:
    print(sum(H))
else:
    print(0)

Solution (Python):
n,k = map(int,input().split())
h = list(map(int,input().split()))

hs = sorted(h,reverse=True)

print(sum(hs[k:]))

Solution (Python):
import sys
import time
import math
import itertools as it
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()


N, K = inpl()
H = inpl()
H.sort()
H.reverse()
for i in range(K):
    if len(H) == i:
        break
    H[i] = 0
print(sum(H))


ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

Solution (Python):

import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    n, k = MI()
    H = LI()
    H.sort()
    H.reverse()

    terget = H[k:]
    print(sum(terget))


main()

Solution (Python):
N,K = map(int,input().split())
ls = list(map(int,input().split()))
ls.sort(reverse=True)
if N <= K:
    print(0)
else:    
    print(sum(ls[K:N+1]))

Solution (Python):
def main():
    n, k = map(int, input().split())
    h = [int(x) for x in input().split()]
    h_s = sorted(h)
    if len(h_s) <= k:
        ans = 0
    else:
        for _ in range(k):
            h_s.pop()
        ans = sum(h_s)
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin
input = stdin.readline


def main():
  N, K = list(map(int, input().split()))
  H = list(map(int, input().split()))
  H = sorted(H)

  if K == 0:
    print(sum(H))
    return
  print(sum(H[:-K]))


if(__name__ == '__main__'):
  main()

Solution (Python):
n,k=map(int,input().split());print(sum(sorted(map(int,input().split()),reverse=True)[k:]))

Solution (Python):
N,K=map(int,input().split())
I=list(map(int,input().split()))
H=[]
I=sorted(I,reverse=True)
H=I[K:]
s=0
for i in H:
  s+=i
print(s)

Solution (Python):


import sys




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




if K >= len(H):
    print(0)
    sys.exit()

H.sort(reverse = True)

print(sum(H[K:]))

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort()
if k!= 0:
    print(sum(h[:-k]))
else:
    print(sum(h))

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))
if N <= K:
    print(0)
else:
    h_sorted = sorted(H,reverse=True)
    ans = sum(h_sorted[K:])
    print(ans)

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,string
import numpy as np
import sys
sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N,K = LI()
H = LI()

Hs = np.array(sorted(H, reverse=True))

ans = np.sum(Hs[K:])

print(ans)

Solution (Python):
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
h.sort(reverse=True)

print(sum(h[k:]))

Solution (Python):
_, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

H.sort(reverse=True)
print(sum(H[K:]))

Solution (Python):
from collections import Counter as Ct
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n,k=INTM()
    a=LIST()
    a=sorted(a,reverse=True)
    if n<=k:
        ans=0
    else:
        ans=sum(a[k:])

    print(ans)
if __name__=='__main__':
    do()

Solution (Python):
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort()
ans=0
if N-K>0:
  for x in range(N-K):
    ans += H[x]
print(ans)

Solution (Python):
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))
print(sum(sorted(H)[:max(0,N-K)]))

Solution (Python):
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())))

ans = 0
for i in range(N - K):
    ans += H[i]
print(ans)

Solution (Python):
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
print(sum(h[k:]))

Solution (Python):

N, K = map(int, input().split())
H = list(map(int, input().split()))
H = sorted(H, reverse=True)

for i in range(min(N,K)):
    H[i] = 0

ans = sum(H)
print(ans)

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))

if n<=k:
  print(0)
  
else:
  a=sorted(a)
  b=n-k
  ans=0
  for x in range(n-k):
    ans+=a[x]
    
  print(ans)

Solution (Python):
n1, n2 = [int(i) for i in input().split()]

n3 = [int(j) for j in input().split()]

n3.sort(reverse=True)

n4 = 0
for i1 in range(n1):
    if i1 >= n2:
        n4 += n3[i1]
print(n4)

Solution (Python):
N,K = map(int, input().split())
H = list(map(int, input().split()))

temp = sorted(H,reverse=True)
new_H = temp[K:len(temp)]

if(N-K<=0):
    print(0)
else:
    print(sum(new_H))

Solution (Python):

n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)

ans = 0
for i in range(k,n):
    ans += h[i]

print(ans)

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

Solution (Python):
n, k = map(int, input().split())
H = list(map(int, input().split()))

if k >= len(H):
    print(0)
    exit()

H.sort(reverse=True)

print(sum(H[k:]))

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))

if N <= K:
  print(0)
  exit()
  
H.sort(reverse=True)
print(sum(H[K:]))

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().strip().split()))[:n]
h.sort()
if(k>=n):
    print(0)

elif(k==0):
    b=sum(h)
    print(b)
elif(k<n):
    b=sum(h[:-k])
    print(b)

Solution (Python):
n,k=map(int, input().split())
h=list(map(int, input().split()))
h.sort(reverse=True)
print(sum(h[k:]))

Solution (Python):
n,k=map(int,input().split())
h=sorted(list(map(int, input().split())))
res=0
if k>=n:res=0
else:
    res+=sum(h[:n-k])
print(res)

Solution (Python):
N, K = map(int,input().split())
Monsters = list(map(int,input().split()))
Monsters.sort(reverse=True)

for i in range(min(K,N)):
    Monsters[i]=0
print(sum(Monsters))

Solution (Python):
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())))

print(sum(H[:-K] if K != 0 else H))

Solution (Python):
N,K,*H = map(int, open(0).read().split())
H.sort(reverse=True)
print(sum(H[K:]))

Solution (Python):
N, K = map(int,input().split())
H = sorted(list(map(int,input().split())))

for p in range(K):
    if N-p-1 >= 0:
        H[N-p-1] = 0

print(sum(H))

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

Solution (Python):
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())),reverse=True)
print(sum(H[K:]))