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())
A = list(map(int, input().split()))
A.sort()
S = 0
for i in range(0, K):
    if len(A) > 0:
        A.pop(-1)
print(sum(A))

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

H = sorted(H, reverse=True)[K:]
print(sum(H))

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

Solution (Python):
import sys
lines = sys.stdin.readlines()
n, k = [int(i) for i in lines[0].rstrip().split(" ")]
h = [int(i) for i in lines[1].rstrip().split(" ")]

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)

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

Solution (Python):

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

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






H_sum = sum(H_list) 

Hk_sum = 0
H_list = sorted(H_list, reverse=True)
rep = K if K< N else N
for i in range(rep):
    Hk_sum += H_list[i]
    
Attack_num = H_sum - Hk_sum

print(Attack_num)

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

if k > n:
    k = n

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

print(sum(h))

Solution (Python):
n,k = list(map(int,input().split()))
h = list(map(int, input().split()))
if n<=k:
  print("0")
  exit()
new_h = sorted(h)
for i in range(k):
  new_h.pop(-1)
print(sum(new_h))

Solution (Python):
import numpy as np
N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]

sorted_H = sorted(H)
num = np.maximum(0, N-K)
answer = sum(sorted_H[:num])
print(answer)

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

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

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

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 = ans + H[i]
print(ans)

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

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

print(sum(sorted(mons, reverse=True)[k:]))

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

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

Solution (Python):
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines







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

if __name__ == "__main__":
	main()

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

sn = sum(a[k:])

print(sn)

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

N, K = D[0], D[1]
NewH = sorted(H, reverse = True)
print(sum(NewH[K:]))

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

Solution (Python):

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

idx = max(len(H)-K,0)
print (sum(H[:idx]))

Solution (Python):
a,b=map(int,input().split())
if a<=b:
  print("0")
  exit()
c=list(map(int,input().split()))
c.sort()
ans=0
for i in range(a-b):
  ans+=c[i]
print(ans)

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

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

print(sum(sorted(li_h, reverse=True)[k:]))

Solution (Python):



def main():
  n, k = map(int, input().strip().split())
  Hs   = list(map(int, input().strip().split()))
  Hs.sort(reverse=True)
  print(sum(Hs[k:]))

if __name__=='__main__':
  main()

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

if k >= len(l):
  print(0)
else:
  print(sum(l[k:]))

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

if k >= len(l):
  print(0)
else:
  print(sum(l[k:]))

Solution (Python):
eneNum, spNum = map(int, input().split())
eneHp = map(int, input().split())
eneHpList = list(eneHp)









eneHpList.sort()
eneHpList.reverse()
del eneHpList[0:min([spNum, len(eneHpList)])]
count = sum(eneHpList)

print("{}".format(count))

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

hs=sorted(h)
if n<=k:
  print('0')
else:
  print(sum(hs[:n-k]))

Solution (Python):




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


if __name__ == "__main__":
    main()

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
H = sorted(LIST())

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, K = MAP()
H = LIST()
H.sort()

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

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

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

del Hi[:K]
print(sum(Hi))

Solution (Python):
import sys

def main():

    

    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)

if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    h = list(map(int, input().rstrip('\n').split()))
    h.sort()
    t = 0
    for i in range(n - k):
        t += h[i]
    print(t)


if __name__ == '__main__':
    solve()

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

H = sorted(H, key= lambda x:-x)[K:]
print(sum(H))

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

for i in range(K):
    if len(H)!=0:
        H.remove(max(H))
        
    else:
        
        break
print(sum(H))'''

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())
a=sorted(list(map(int,input().split())),reverse=True)
print(sum(a[k:]))

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

H.sort(reverse=True)
attack_count = 0

if N <= K:
	pass
else:
	for i in range(K, N):
		attack_count += H[i]

print(attack_count)

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

Solution (Python):

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

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

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

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))
    l = len(A)
    A.sort(reverse = True)
    if K >= l:
        print(0)
    else:
        print(sum(A[K:]))
    
if __name__ == "__main__":
    main()

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

Solution (Python):
def solve(n, k, h):
    if k == 0:
        return sum(h)
    else:
        return sum(sorted(h)[:-min(n, k)])

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

Solution (Python):
import math

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

atk = 0

H.sort()

for i in range(N - K):
    atk += H[i]

print(atk)

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

H.sort(reverse=True)

print(sum(H[K:]))

Solution (Python):
a,b=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
if len(l)<=b:
    print(0)
else:
    print(sum(l[:len(l)-b]))

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

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

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

Solution (Python):
import math

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

H.sort()
n = N - K if N - K > 0 else 0

print (sum(H[0:n]))

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

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

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

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

h.sort()
n -= k
if k > len(h):
    for i in range(len(h)):
        h.pop()
else:
    for i in range(k):
        h.pop()

ans = 0
for i in range(len(h)):
    ans += h[i]

print(ans)

Solution (Python):
N,K = list(map(int,input().split(" ")))
Hs = list(map(int,input().split(" ")))
Hs.sort()
ans = 0


for i in range(N - K ):
    ans += Hs[i]

print(ans)

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

h.sort()
h.reverse()

del h[:k]
print (sum(h))

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

critical = 0
h.sort()
if n <= k:
    print(0)
    exit()
else:
    for i in range(1,k+1):
        critical += h[-i]

    print(sum(h)-critical)

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

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

print(x)

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

if K >= N:
    print(0)
else:
    sum = [0]
    for i in range(0, N):
        
        sum.append(sum[i]+H[i])

    
    print(sum[N]- sum[K])

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

Solution (Python):
inp = list(map(int, input().split()))
N = inp[0]
K = inp[1]
H = list(map(int, input().split()))

H.sort(reverse=True)

sum = 0
for count in range(N):
        if count >= K:
            sum += H[count]

print(sum)

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())
H = list(map(int,input().split()))
H.sort(reverse=True)
ans = sum(H[K:])
print(ans)

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

for i in range(N):
    if i + 1 <= K:
        continue
    ans = ans + H[i]

print(ans)

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

b.sort()

if n>=a:
  print(0)
  exit()

if n==0:
  print(sum(b))
  exit()
  
c=b[:-1*n]

print(sum(c))

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

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

if __name__ == '__main__':
    N, K = map(int, input().rstrip().split())
    H = list(map(int, input().rstrip().split()))
    if K >= N:
        print(0)
    else:
        sorted_H = sorted(H, reverse=False)[:N-K]
        print(sum(sorted_H))

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

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

Solution (Python):
enemyNum,hissatsu = map(int, input().split())
point = input().split()
point = sorted(point, key = int)
count = 0
if enemyNum - hissatsu <= 0:
  print(0)
else:
  for i in range(enemyNum - hissatsu):
    count += int(point[i])
  print(count)

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

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

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

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

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

h.sort(reverse = True)

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

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

A.sort()

ans = 0

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

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

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):
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)
print(sum(H[K:]))

Solution (Python):
monstar,hisatu= map(int,input().split())
m_life=list(map(int,input().split()))

m_life.sort()
count =0

for i in range(len(m_life)-hisatu):
    count += m_life[i]
print(count)

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

rh = sorted(h, reverse=True)
print(sum(rh[k:]))

Solution (Python):
monster, hisatu = map(int, input().split())
m_life = list(map(int, input().split()))
m_life.sort()
count = 0
for i in range(len(m_life)-hisatu):
    count += m_life[i]
print(count)

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

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



H.sort(reverse=True)

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

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

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

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

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

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

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


res = 0
h = sorted(h, reverse=True)

for hh in h:
    if k > 0:
        k -= 1
    else:
        res += hh
print(res)

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

s = sorted(h)
ans = 0

c = n[0] - n[1]

if c > 0:
  for i in range(c):
    ans = s[i] + ans

print(ans)

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

if len(h)<=k:
    print('0')
else:
    print(sum(h[0:len(h)-k]))

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

array.sort()
total = 0

for i in range(n-k):
    total +=  array[i]


print(total)

Solution (Python):
n,k = (int(i) for i in input().split())
h = [int(i) for i in input().split()]
h.sort(reverse=True)
if k>=n:
  print(0)
else:
  print(sum(h[k:]))

Solution (Python):
N, K = map(int, input().split())
*H, = map(int, input().split())
H.sort(reverse=True)
ans = 0
if len(H) - K <= 0:
    print(0)
else:
    ans += sum(H[K:])
    print(ans)

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

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

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

H.sort(key=lambda x: -x)

c = min(K, N)

i = 0
while 0 < c:
    H[i] = 0
    c -= 1
    i += 1

ans = 0
for j in range(i, N):
    ans += H[j]

print(ans)

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

Solution (Python):
import sys
n,k = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
if n<=k:
    print(0)
elif k==0:
    print(sum(a))
else:
    a.sort()
    print(sum(a[:-k]))

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

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

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

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

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

Solution (Python):
import heapq
n, k = [int(i) for i in input().split()]
h = [-int(i) for i in input().split()]
res = -sum(h)
heapq.heapify(h)

for i in range(min(k, n)):
    res += heapq.heappop(h)

print(max(0, res))

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

Solution (Python):
import sys

N, K, *H = map(int, open(0).read().split())

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

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

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

a.sort()

print(sum(a[:-k]) if k!=0 else sum(a))

Solution (Python):

n, k = 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)

Solution (Python):

n, k = 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)

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

ans = 0
for h in H:
    if K > 0:
        K -= 1
    else:
        ans += h

print(ans)

Solution (Python):

import math

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

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

if N > K:
    if K == 0:
        ans = sum(H)
    else:
        ans = sum(H[:-K])
else:
    ans = 0

print(ans)

Solution (Python):
num,SPAttackNum =map(int,input().split())

hpList=list(map(int,input().split()))
hpList.sort()

for i in range(min(SPAttackNum,num)):
    hpList.pop()

print(sum(hpList))

Solution (Python):
a=input().rstrip().split(" ")
b=input().rstrip().split(" ")

c=[]

for i in range(int(a[0])):
  c.append(int(b[i]))

d=sorted(c)

S=0

for j in range(int(a[0])-int(a[1])):
  S += d[j]

print(S)

Solution (Python):
N, K = map(int, input().split())
H = [int(N) for N in input().split()]
H.sort(reverse=True)
if N <= K:
    print(0)
else:
    for i in range(0, K):
        H[i] = 0
    print(sum(H))

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

print(sum(h[k:]))

Solution (Python):
n,k = map(int,input().split())
h = list(map(int,input().split()))
h = sorted(h)
if k >= n:
  print(0)
else:
  print(sum(h[:n-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()))
H.sort()
print(sum(H[:-K]) if K != 0 else sum(H))

Solution (Python):
N,K = [int(x) for x in input().split()]
enemies = [int(x) for x in input().split()]
enemies = list(sorted(enemies))[::-1]
print(sum(enemies[K:]))

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

n_attack = sum(hs[k:]) if k < n else 0
print(n_attack)

Solution (Python):
import sys

input = sys.stdin.readline

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

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

print(sum(Hs[:-K if K > 0 else len(Hs)]))

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
import heapq
input = sys.stdin.readline

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

Hs = [-int(c) for c in input().split()]
heapq.heapify(Hs)

for _ in range(min(K, len(Hs))):
    heapq.heappop(Hs)

print(-sum(Hs))

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

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

H.sort()

for i in range(0,K):
    if H:
      H.pop()

print(sum(H))

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

h_sorted = sorted(h,reverse=True)



h_remaining = h_sorted[k:]

ans = sum(h_remaining)

print(ans)

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

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

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

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

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

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

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, K: int, H: "List[int]"):
    H.sort(reverse=True)
    print(sum(H[K:]))
    return



def main():
    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)]  
    solve(N, K, H)

if __name__ == '__main__':
    main()

Solution (Python):
n,k,*a=map(int,open(0).read().split());a.sort();print(sum(a[:max(n-k,0)]))

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

print(num)

Solution (Python):
List = []
b = 0

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

for i in range(len(H)):
    a = int(H[i])
    List.append(a)
    
List.sort()

for i in range(K):
    List.pop()
    if len(List) == 0:
        break
        
for i in range(len(List)):
    b = b + List[i]

print(b)

Solution (Python):
from sys import stdin
N, K = [int(_) for _ in stdin.readline().rstrip().split()]
H = sorted([int(_) for _ in stdin.readline().rstrip().split()], reverse=True)
print(sum(H[K:]))

Solution (Python):
import math
def IN(): return map(int,input().split())
ans = 0; mod = pow(10,9)+7
n,k=IN()
A=sorted(list(IN()))
for i,a in enumerate(A):
  if i<n-k:ans+=a
print(ans)

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):
N, K = map(int,input().split())
N_hp = list(map(int,input().split()))
N_hp.sort(reverse=True)
del N_hp[:K]
sum_turn = sum(N_hp)
print(sum_turn)

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

if K >= N:
	print(0)
	exit()
else:
	ans = 0
	for i in range(K):
		h[i] = 0
	ans += sum(h)
	print(ans)

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):
n,k=map(int, input().split())
h=list(map(int, input().split()))
list.sort(h, reverse=True)
h=h[k:]
print(sum(h))

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

H = sorted(H, reverse=True)

print(sum(H[K:]))

Solution (Python):

from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left
INF = float('inf')

N, K=map(int, input().split())
HP=sorted(list(map(int, input().split())), reverse=True)
cnt = 0
for i in range(N):
    if K > 0:
        K -= 1
        continue
    cnt += HP[i]

print(cnt)

Solution (Python):



def main():
    n, k = map(int, input().split())
    h = sorted(list(map(int, input().split())), reverse=True)
    count = 0
    ans = 0

    for hi in h:
        if count >= k:
            ans += hi

        count += 1

    print(ans)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
n, k = map(int, input().strip().split())
a = sorted(map(int, input().split()), key= lambda x: -x)
print(sum(a) - sum(a[:k]))

Solution (Python):
from heapq import nsmallest

N, K = map(int, input().split())
H = (int(x) for x in input().split())

print(sum(nsmallest(N - K, H)))

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([int(_) for _ in input().split()])
print(0 if N<=K else sum(H[:N-K]))

Solution (Python):
N=[int(x) for x in input().split()]
H=[int(y) for y in input().split()]
H=sorted(H,reverse=True)
print(sum(H[N[1]:]))

Solution (Python):
monster_num, spattack_num = input().split()

monster_num = int(monster_num)

spattack_num = int(spattack_num)

hplist = list(input().split())

hplist = list(map(int, hplist))

hplist = sorted(hplist, reverse=True)

value = 0

if spattack_num >= monster_num:
    print(0)
else:
    for i in range(spattack_num):
        hplist[i] = 0

    for i in range(monster_num):
        value = value + hplist[i]

    print(value)