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())
print(sum(sorted(map(int, input().split()))[:max(N - K, 0)]))

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):
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
ans = 0
for i in range(min(K,N)):
    H.pop()
ans += sum(H)
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.sort(reverse=True)
print(sum(h[k:]))

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

h_sort = sorted(h, reverse=True)
ans = sum(h_sort[k:])

print(ans)

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

H.sort(reverse=True)

for i in range(N):
    if i<K:
        H[i] = 0


print(sum(H))

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

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

ans = 0

if n <= k:
    print(0)
else:
    for j in range(n-k):
        ans += i[j]
    print(ans)

Solution (Python):











import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,hypot,log 
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K = MI()
    H = LI()
    H.sort(reverse=True)
    print(sum(H[K:]))

if __name__ == '__main__':
    main()

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

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

for i in range(n):
    if k:
        k -= 1
    else:
        ans += monster[i]

print(ans)

Solution (Python):
def solve(string):
    n, k, *h = map(int, string.split())
    return str(sum(sorted(h)[:max(n - k, 0)]))


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

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

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

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

if __name__ == '__main__':
    main()

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

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

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):
a, b=map(int,input().split())
l=list(map(int,input().split()))
if a<=b:
  print(0)
elif a>b:
  l.sort(reverse=True)
  n=l[b:]
  s=sum(n)
  print(s)

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

if n<=m:
  print(0)
elif m==0:
  print(sum(a))
else:
  a=a[:-m]
  print(sum(a))

Solution (Python):
n,k = [int(x) for x in input().split()]
h = [int(x) for x in input().split()]
h.sort(reverse=True)
  
if(len(h) <= k):
	print("0")
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):
N, K = map(int, input().split())
H = list(map(int,input().split()))


list.sort(H, reverse=True)

print(sum(H[K:]))

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

h = sorted(h, reverse=True)

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

print(sum)

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

Solution (Python):
l1 = list(map(int, input().split()))
l2 = list(map(int, input().split()))

K = l1[1]
l2.sort(reverse=True)
print(sum(l2[K:]))

Solution (Python):
_, K = map(int, input().split())
v = list(map(int, input().split()))
v.sort()

if len(v) <= K:
  print(0)
elif K == 0:
  print(sum(v))
else:
  print(sum(v[:-K]))

Solution (Python):
input_num=[input() for i in range(2)]

n=input_num[0].split()
n=list(map(int,n))
a=input_num[1].split()
a=list(map(int,a))
     
if len(a)<=n[1]:
  print(0)
else:
  a.sort(reverse=True)
  b=a[n[1]:]
  print(sum(b))

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

for i in range(K,N):
  ans = ans + H[i]
if K>=N:
  print ans
else:
  print int(ans)

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

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

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

Solution (Python):
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
A.sort(reverse=True)
B=A[K:]
cnt=0
for i in B:
  cnt+=i
print(cnt)

Solution (Python):





def main():
    """
    ここでプログラムの解説を行う
     >>main()
    Hello world.
    0
    """
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))
    t.sort(reverse=True)
    a = 0  
    b = s[0]
    d = s[1]
    f = 0
    c = sum(t)
    for i in range(d):
        if c != 0:
            c -= t[i]
            t[i] = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':

    
    import sys
    sys.exit(main())

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

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

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

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

H.sort()
Sum = 0

for i in range(N-K):
    Sum += H[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):
a = list(map(int, input().split()))
b = list(map(int, input().split()))

sorted_b = sorted(b,reverse=True)

print(sum(sorted_b[a[1]:a[0]]))

Solution (Python):
N,K = map(int,input().split())
A = sorted([int(i) for i in input().split()],reverse=True)
print(sum(A[K:]))

Solution (Python):
N, K = map(int, input().split())
lst = sorted([int(x) for x in input().split()])
if K == 0:
    print(sum(lst))
else:
    print(sum(lst[:-K]))

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
mod2 = 998244353
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,k = inpl()
a = inpl()
a.sort(reverse=True)
res = 0
for i in range(n):
    if i < k:
        continue
    res += a[i]
print(res)

Solution (Python):
import heapq

n, k = map(int, input().split())
h = list(map(lambda x: int(x)*(-1), input().split()))

if n <= k:
    print(0)
    exit()

heapq.heapify(h)

for _ in range(k):
    heapq.heappop(h)

print(sum(h)*(-1))

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

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):
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()))
s=sorted(h)
if n<k:
  print(0)
  exit()
else:
  print(sum(s[0:n-k]))

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

Solution (Python):

n,k=map(int,raw_input().split())
h=map(int,raw_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, = map(int, input().split())

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

Solution (Python):
'''
8 9
7 9 3 2 3 8 4 6
'''
N, K = [int(x) for x in input().split()]
health = sorted([int(x) for x in input().split()])
print(sum(health[:max(0, N-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:
    c = sum(H)
  else:
    c = sum(H[:-K])
  print(c)

Solution (Python):
import heapq
n,k = map(int, input().split())
h_list = list(map(int, input().split()))
print(sum(heapq.nsmallest(len(h_list)-k, h_list)))

Solution (Python):
x = input().split()
N, K = [int(i) for i in x]
H = input().split()
Hi = [int(j) for j in H]
Hi.sort(reverse=True)
num = Hi[K:]
print(sum(num))

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

print(sum(H[:-K] if K != 0 else 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 = [int(x) for x in input().split()]
H.sort(reverse=True)
del H[0:K]
print(sum(H))

Solution (Python):
n, k = map(int, input().split())
a = sorted(map(int, input().split()), reverse=True)
print(sum(a[i] for i in range(k, n)))

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):
N, K = map(int, input().split())
monsters = [int(x) for x in input().split()]

monsters.sort(reverse=True)

print(sum(monsters[K:]))

Solution (Python):

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


H.sort()
answer = 0
if K >= N:
    answer = 0
else:
    answer += sum(H[0:(N-K)])

print(answer)

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

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

Solution (Python):
H, N = map(int, input().split())
A = [int(x) for x in input().split()]
list2 = sorted(A, reverse=True)  

if N>H:
    print(0)
elif N>0:
    del list2[0:N]
    print(sum(list2))
elif N<=0:
    print(sum(A))

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:N]))

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


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

Solution (Python):

def main():
    N, K, *H = map(int, open(0).read().split())
    need_attacks = sorted(H, reverse=True)[K:]
    print(sum(need_attacks))


if __name__ == "__main__":
    main()

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(list(map(int, input().split())))

if n <= k:
    print(0)
    exit()

cnt = 0
for i in range(n - k):
    cnt += h[i]
print(cnt)

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

H = sorted([int(x) for x in input().split()],reverse = True)

print(sum(H[K:]))

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

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

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

print(ans)

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

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

Solution (Python):
m,n=map(int,input().split())
l=list(map(int,input().split()))
if len(l)==m:
  l.sort()
  if n<=m:
    for i in range(n):
      l.pop()
    print(sum(l))
  else:
    print(0)
else:
  print(0)

Solution (Python):
from sys import stdin

n, k = (int(v) for v in stdin.readline().split())
monsters = [int(v) for v in stdin.readline().split()]


if len(monsters) <= k:
    print("0")
else:
    monsters = sorted(monsters)
    monsters = monsters[:-k] if k > 0 else monsters
    print(sum(monsters))

Solution (Python):
n,k = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
if k >= n :
  print(0)
elif k == 0 :
  print(sum(arr))
else :
	for i in range(k) :
		arr[i] = -1
	sum = 0
	for i in arr :
		if i!=-1 :
			sum+=i

	print(sum)

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

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

Solution (Python):
input_line = list(map(int,input().split()))
input_hp = list(map(int,input().split()))

if input_line[0] <= input_line[1]:
    print('0')
else:
    input_hp.sort()
    result_input_hp = len(input_hp) - input_line[1]
    sum_total = sum(input_hp[:result_input_hp])
    print(sum_total)

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

h.sort()
s = 0

for i in range(n - k):
    s += h[i]

print(s)

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

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

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

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

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

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

Solution (Python):
import sys

def propare():
    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_list = []
    for i in range(N):
        H_list.append(int(next(tokens)))

    solve(N, K, H_list)

def solve(H: int, N: int, H_list: list):
    H_ranking_list = sorted(H_list, reverse=True)
    H_ranking_list = H_ranking_list[N:]

    count = sum(H_ranking_list)

    print(count)

    return
 
if __name__ == "__main__":
    propare()

Solution (Python):
n,k=map(int,input().split())
if(n<=k):
  print(0)
  exit()

H=list(map(int,input().split()))
H.sort()
print(sum(H[:n-k]))

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

Solution (Python):
'''input
3 0
1000000000 1000000000 1000000000
'''
from sys import stdin
input = stdin.readline

def get_me():
	return []



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

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

arr.sort(reverse = True)

l = len(arr)
count = 0
while l > k:
	count += arr[-1]
	arr.pop()
	l -= 1

print(count)

Solution (Python):
def main():
    N, K = [int(x) for x in input().split()]
    hs = [int(x) for x in input().split()]
    hs = sorted(hs, reverse=True)
    if K >= N:
        print(0)
    else:
        hs = hs[K:]
        print(sum(hs))


if __name__ == '__main__':
    main()

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





s = 0

i = 0
while i < n-k:
  s += h[i]
  i += 1

print(s)

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

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

Solution (Python):

from fractions import gcd 
from functools import reduce

def pin(type=int):
    return map(type,input().split())

N,K =pin()
H = list(pin())

H.sort()

ans=0
if N > K:
    for i in range (K):
        H.pop()
    print(sum(H))
else:
    print(0)

Solution (Python):
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations,groupby
import sys
import bisect
import string
import math
import time
import random
def S_():
    return input()
def LS():
    return [i for i in input().split()]
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def NI(n):
    return [int(input()) for i in range(n)]
def NI_(n):
    return [int(input())-1 for i in range(n)]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def LtoS(ls):
    return ''.join([chr(i+97) for i in ls])
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'

    mp=[1]*(w+2)
    found={}
    for i in range(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[1]+[mp_def[j] for j in s]+[1]
    mp+=[1]*(w+2)
    return h+2,w+2,mp,found
def bit_combination(k,n=2):
    rt=[]
    for tb in range(n**k):
        s=[tb//(n**bt)%n for bt in range(k)]
        rt+=[s]
    return rt
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**7)
input=lambda: sys.stdin.readline().rstrip()

def ran_input():
    import random
    n=random.randint(4,16)
    rmin,rmax=1,10
    a=[random.randint(rmin,rmax) for _ in range(n)]
    return n,a

show_flg=False
show_flg=True

ans=0

n,k=LI()
h=sorted(LI())
ans=sum(h[:max(0,n-k)])

print(ans)

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

Solution (Python):
m, n = map(int, input().split())
li = list(map(int, input().split()))
if n >= m:
  print(0)
elif n == 0:
  print(sum(li))
else:
  print(sum(sorted(li)[:-n]))

Solution (Python):





def main():
    """
    ここでプログラムの解説を行う
     >>main()
    Hello world.
    0
    """
    s = list(map(int, input().split()))
    t = list(map(int, input().split()))
    t.sort(reverse=True)
    a = 0  
    b = s[0]
    d = s[1]
    f = 0
    
    
    
    
    
    
    
    
    
    
    
    
    c = sum(t)
    for i in range(d):
        if c != 0:
            c -= t[i]
            t[i] = 0
        else:
            break
    a += sum(t)
    print(a)
    return 0

if __name__ == '__main__':

    
    import sys
    sys.exit(main())

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

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

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

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

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

Solution (Python):


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

h.sort(reverse=True)
count = 0
for i in range(k, n):
  count += h[i]
print(count)

Solution (Python):
nk = [int(s) for s in input().split()]
n, k = nk[0], nk[1]
arr = [int(s) for s in input().split()]
if k >= n:
    print(0)
else:
    arr.sort()
    print(sum(arr[:n-k]))

Solution (Python):
import math


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

K = min(N,K)


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

data.sort()

total = sum( data[0:N-K] )


print(total)

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

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):
H,K = map(int,input().split())
Monster = list(map(int,input().split()))

if H<=K:
    print(int(0))
else:
    KK = 0
    KK =int(K)
    ReMonster = 0
    list.sort(Monster,reverse= True)
    del Monster[0:KK]
    print(sum(Monster[:]))

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

h.sort()

if k > n:
    print(0)
    exit()

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

s = sum(h)

print(s)

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

a.sort(reverse=True)


print(sum(a[n:]))

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 = [int(x) for x in input().split()]

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

if n <= k:
    print("0")
else:
    print(sum(sorted(h_n)[:n - k]))

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

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

Solution (Python):
def f(h,k):
    N=len(h)
    t=0
    h.sort()
    for i in range(N-k):
        t+=h[i]
    return t
N,k=map(int,input().split())
h=list(map(int,input().split()))
print(f(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 math

n, k = [int(x) for x in input().split()]

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

if n <= k:
    print("0")
else:
    s_n = sorted(h_n)

    print(sum(s_n[:n-k]))

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[:len(h)-k]))

Solution (Python):
a,b = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse = True)
if b>=a:
    print(0)
else:
    print(sum(arr[b:]))

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

H.sort()

Ans = 0
for x in range(0,min(K,N)):

    H.pop()

for x in H:
    Ans = x+Ans
print(Ans)

Solution (Python):


import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k = LI()
h = LI()
h.sort(reverse=1)
ans = sum(h[min(n,k):])
print(ans)

Solution (Python):
import heapq

N,K = (int(x) for x in input().split())
H = list((-1)*(int(x)) for x in input().split())
heapq.heapify(H)
count = 0

for _ in range(K):
    if len(H) == 1:
        print(0)
        break

    heapq.heappop(H)
    count += 1

if len(H) != 1:
    sum = 0
    for _ in range(len(H)):
        sum -= heapq.heappop(H)

    print(sum)

elif len(H) == 1 and K == count:
    print(-heapq.heappop(H))

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

res = sum(h[k:])

print(res)

Solution (Python):
import sys
import math
import itertools
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort(reverse=True)
total=0
for i in range(N):
    if i>K-1:
        total+=H[i]
print(total)

Solution (Python):
import sys

read = sys.stdin.read

N, K, *H = map(int, read().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(map(int,input().split()))
h.sort()
ans = int(0)
for i in range(len(h) - k):
    ans += int(h[i])
print(ans)

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:n]))

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









if N <= K:
    print(0)
    exit()


H.sort(reverse=True)



r_H = H[K:]



sum_H = 0
for hp in r_H:
    sum_H += hp
print(sum_H)

Solution (Python):
import math

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

H.sort()
if K == 0:
    print(sum(H))
elif K >= N:
    print(0)
else:
    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)
ans = 0
for i in range(k, n):
  ans+=h[i]
  
print(ans)

Solution (Python):
def c_fennec_vs_monster():
    N, K = [int(i) for i in input().split()]
    H = sorted([int(i) for i in input().split()])
    return sum(H[:N - min(K, N)])

print(c_fennec_vs_monster())

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









if N <= K:
    print(0)
    exit()


H.sort(reverse=True)



r_H = H[K:]





print(sum(r_H))

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

Solution (Python):

bodies_count = list(map(int,input().split()))
enemy_life = list(map(int,input().split()))

if bodies_count[1] == 0:
    print(sum(enemy_life))
else:
    enemy_life.sort(reverse=True)
    if bodies_count[1] == 1:
        del enemy_life[0] 
    else:
        a = bodies_count[1]
        del enemy_life[0:a]

    if enemy_life != []:
        print(sum(enemy_life))
    else:
        print(0)

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

Solution (Python):
n,k,*h=map(int,open(0).read().split())
print(sum(sorted(h)[:n-min(n,k)]))

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


if N <= K:
    print(0)

elif K == 0:
    print(sum(H))

else:
    H.sort()
    H.reverse()
    print(sum(H[K:N]))

Solution (Python):
class Main:
    s = list(map(int, input().split()))
    n = s[0]
    k = s[1]
    sum = 0
    kSum = 0
    list = [int(i) for i in input().split()]
    newList = sorted(list, reverse=True)
    list[:k]
    for num in newList:
        sum += num
    for kNum in newList[:k]:
        kSum += kNum
    print(sum-kSum)

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

atack_number = len(enemies) - k

if atack_number <= 0:
    print(0)
else:
    
    enemies.sort()
    atack_select = enemies[:atack_number]
    print(sum(atack_select))

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

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

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

print(ans)