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()
for i in range(K):
    if len(H) > 0:
        H.pop()
    else:
        H.append(0)
print(sum(H))

Solution (Python):
HK = list(map(int,input().split(" ")))
HP = list(map(int,input().split(" ")))
H = HK[0]
K = HK[1]
HP.sort(reverse=True)
sum_a = sum(HP[K:])
print(sum_a)

Solution (Python):
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
print(sum(sorted(h, reverse=True)[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())
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()))

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

Solution (Python):
n, k = map(int, input().split())
li = list(map(int, input().split()))
li_a = sorted(li)
if k == 0:
  print(sum(li_a))
elif k >= n:
  print(0)
else:
  for i in range(k):
    li_a.pop()
  print(sum(li_a))

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

Solution (Python):
import numpy as np

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

if N > K != 0:
    H_array = np.array(H).reshape(-1)

    H_array_sorted = np.sort(H_array)

    H_remain = H_array_sorted[:(N - K)]

    H_sum = np.sum(H_remain)

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

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

Solution (Python):
import numpy as np
N,K=map(int,input().split())
H_list=[float(H) for H in input().split()]
H_sort=np.sort(H_list)
if K==0:
    print(int(sum(H_sort)))
else:
    print(int(sum(H_sort[:-K])))

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


if(K >= N):
    print(0)
else:
    new_li = li[0:N-K]
    print(sum(new_li))

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

H.sort(reverse=True)

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

print(sum(H))

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

Solution (Python):
a, b = map(int, input().split())
N = list(map(int, input().split()))
N.sort()
for i in range(b):
    if N:
        N.pop()
print(sum(N))

Solution (Python):
n,k = map(int,input().split())
oppo = list(input().split())
for i in range(len(oppo)):
    oppo[i] = int(oppo[i])

oppo = sorted(oppo)
attack = 0

if  k >= n:
    print(0)
else:
    for i in range(0,len(oppo)-k):
        attack = attack + oppo[i]
    print(attack)

Solution (Python):
N = 0
K = 0

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

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

H_list.sort(reverse=True)
  

print(sum(H_list[K:]))

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

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

    del H[0:K]
    print(sum(H))

Solution (Python):
def run():
  N, K = map(int, input().split())
  H_li = sorted(map(int, input().split()))
  if N <= K:
    print(0)
  else:
    H_sum = sum(H_li[:N-K])
    print(H_sum)
  
if __name__ == '__main__':
  run()

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

x=min(n,k)
del h[0:x]




print(sum(h))

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

if K==0:
	print(sum(s))
elif K!=0:
	ans=sum(s[:-K])
	print(ans)

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

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

H.sort(reverse=True)

del H[:K]
print(str(sum(H)))

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

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

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

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

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

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

attack_sum = 0
monster.sort()
for i in range(N - K):
    attack_sum += monster[i]
print(attack_sum)

Solution (Python):
from operator import add
from functools import reduce

val = input().split(' ')
h = int(val[0])
k = int(val[1])
h = sorted([int(i) for i in input().split(' ')])

remains = h[:-k] if k > 0 else h
print(reduce(add, remains) if len(remains) > 0 else 0)

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

    n_attack = 0
    for i in range(len(h)-k):
        n_attack += h[i]

    print(n_attack)

Solution (Python):
n,k = map(int,input().split())
a = sorted(list(map(int,input().split())),reverse=True)
summ = 0
if k > 0 and k < n:
    del a[0:k]
elif n <= k:
    a = []
summ = sum(a)
print(summ)

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

Solution (Python):
def resolve():
    n, k = map(int, input().split())
    hp = list(map(int, input().split()))
    hp.sort()
    if n > k:
        for i in range(k):
            hp.pop()
    else:
        for i in range(n):
            hp.pop()
    print(sum(hp))




if __name__ == "__main__":
    resolve()

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

  print(ans)

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

h_2 = sorted(h, reverse=True)

if n <= k:
    print(0)

else:
    h_3 = h_2[k:]
    print(sum(h_3))

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

rm = sorted(H)[0:max(N-K, 0)]
print(sum(rm))

Solution (Python):

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






H_SORT = sorted(H, reverse=True)




if K >=N:
    print(0)
else:
    del H_SORT[0:K]
    SUM = 0
    for j in range(len(H_SORT)):
        SUM += H_SORT[j]

    print(SUM)

Solution (Python):
import heapq
[n, k] = list(map(int, input().split()))
Healths = list(map(int, input().split()))
sum = 0
hh = heapq.nlargest(k, Healths)
for h in hh:
  sum+=h

sum2=0
for h in Healths:
  sum2+=h

print(sum2 - sum)

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

Solution (Python):
N,K=input().split()
A=list(map(int,input().split()))
n=int(N)
k=int(K)
B=sorted(A)
ans=0
for i in range(n-k):
  ans+=B[i]
print(ans)

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

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

print(ans)

Solution (Python):
n, k = input().split()
N = int(n)
K = int(k)
lis_H= list(map(lambda x: int(x), input().split()))
haha = sorted(lis_H)
haha.reverse()
ans = sum(haha[K:])
print(ans)

Solution (Python):
a,b = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
for i in range(b):
    if N:
        N.pop()
print(sum(N))

Solution (Python):
a,b = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
for i in range(b):
    if N:
        N.pop()
print(sum(N))

Solution (Python):
import sys
import numpy as np


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


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

h.sort(reverse=True)
h_ar = np.array(h)

if k > 0:
    h_ar[:k] = 0

print(h_ar.sum())

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

ans = sum(list[k:])

print(ans)

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

monsters = sorted(monsters)

left_num = N-K
if left_num <= 0:
    print(0)
else:
    left_mosnters = monsters[:left_num]
    print(sum(left_mosnters))

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

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

del H[0:K]

print(sum(int(i) for i in H))

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

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

H.sort(reverse = True)

answer = sum(H[K:])
print(answer)

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

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

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

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

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

Solution (Python):
import sys
import fractions
input = sys.stdin.readline
N, K = 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())
H =[int(i) for i in input().split()]
H.sort()

for _ in range(K): 
  if len(H) > 0: H.pop()
  else: break

print(sum(H))

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

print(c)

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

print(sum)

Solution (Python):
nk = list(map(int, input().split()))
n = nk[0]
k = nk[1]
h = list(map(int, input().split()))


h_sorted = sorted(h)
l = 0
if k > 0 and k <= n:
    l = h_sorted[-k]
elif k > n:
    l = 0
else:
    l = 10 ** 10

r = 0
for hh in h:
    if hh < l:
        r += hh

print(r)

Solution (Python):
N,K = map(int,input().split(" "))
l = list(map(int,input().split(" ")))
H = sorted(l,key=int) 
c = 0
if(K >= N):
    c = 0
else:
    for i in range(K):
        del H[-1]
    for i in H:
        c = c+i
print(c)

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

if K>len(H):
    print("0")
else:
    heap=[]
    for item in H:
        item=item*(-1)
        heapq.heappush(heap, item)

    for _ in range(K):
        heapq.heappop(heap)

    H2 = list(map(lambda x: x * (-1), list(heap)))
    
    H2 = sum(H2)
    print(H2)

Solution (Python):
n, k = map(int, input().split())
H = sorted(map(int, input().split()))
ans = 0

if n <= k:
    print("0")
else:
    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()

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

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

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

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

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

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

Solution (Python):

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

h.sort(reverse=True)

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

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

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

H.sort(reverse=True)
J = H[K:(N+1)]
C = sum(J)

print (C)

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

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

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


def main():
    _h = sorted(H)

    if K > 0:
        _h = _h[0:-K]

    
    return sum(_h)


ans = main()

print(ans)

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

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

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

h.sort(reverse=True)

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

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

if k == 0:
    print(sum(H))
    exit()

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

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

Solution (Python):

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

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


if __name__ == '__main__':
    main()

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

if n <= a:
  print(0)
else:
  aaa = list(map(int, input().strip().split()))

  aaa = sorted(aaa, reverse=True)
  h = 0
  for i in range(a, n):
    h += aaa[i]

  print(h)

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

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

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

Solution (Python):
import math

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

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

Solution (Python):
from sys import stdin
lines = stdin.readlines()
 
N, K = map(int, lines[0].split())
H = sorted(map(int, lines[1].split()), reverse=True)

print(sum(H[K:]))

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

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

li.sort()
li.reverse()

su=0

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

Solution (Python):
N,K=map(int,input().split())
H=sorted(list(map(int,input().split())),reverse=True)
if N<K: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()))

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

Solution (Python):
x = input().split(" ")
n = int(x[0])
k = int(x[1])
h = list(map(int,input().split(" ")))

h.sort(reverse=True)

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

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

H.sort()

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

Solution (Python):
def attacks(k, healths):
    if k == 0:
        return sum(healths)

    healths.sort()
    return sum(healths[:-k])


if __name__ == '__main__':
    n, k = ([int(s) for s in input().split()])
    healths = [int(s) for s in input().split()]

    print(attacks(k, healths))

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

Solution (Python):
tekinokazu, hissatsu = map(int, input().split())
hp_list = list(map(int, input().split()))

hp = sorted(hp_list, reverse=True)

del hp[:hissatsu]

print(sum(hp))

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

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

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

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

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

print(ans)

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

Solution (Python):
def main():
    N,K = (int(x) for x in input().split())
    h = list(map(int, input().strip().split()))
    H = sorted(h, reverse=True)
    del H[:K]
    print(sum(H))


if __name__ == '__main__':
    main()

Solution (Python):
n,k=map(int,input().split())
l=[int(x) for x in input().split()]
l.sort()
while k and len(l):
    l.pop()
    k-=1
if len(l):
    print(sum(l))
else:
    print(0)

Solution (Python):
N,K = map(int,input().split())
H = list(map(int,input().split()))
lst=sorted(H)
if K > len(H):
  K=len(H)
for i in range(K):
  lst[N-i-1]=0
ans=sum(lst)
print(ans)

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

if (K>=len(list)):
  print(0)
else:
  print(sum(sorted(list, reverse=True)[K:]))

Solution (Python):


import numpy as np
from sys import stdin


def get_result(data):
    N, K = data[0]
    H = sorted(data[1])
    return 0 if N <= K else sum(H[0:(N-K)])

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)

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

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

Solution (Python):
en_num, hiss_num = [int(a) for a in input().split(' ')]
en_h_list = [int(b) for b in input().split(' ')]
en_h_list.sort()

aa = max(0, len(en_h_list)-hiss_num)

en_h_list = en_h_list[:aa]

print(
  sum(en_h_list)
)

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

resolve()

Solution (Python):

def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    h.sort(reverse=True)
    result = 0

    for i in range(n):
        if k > 0:
            k -= 1
        else:
            result += h[i]
    print(result)


if __name__ == "__main__":
    main()

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

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

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

H = list(reversed(sorted(H)))

print(sum(H[K:]))

Solution (Python):


n, k = map(int, input().split())
H = sorted([int(i) for i in input().split()], reverse=True)

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

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

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

if k >= len(hp_list):
    print(0)
    sys.exit()

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

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

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

Solution (Python):
i = list(map(int,input().split()))
i2 = list(map(int,input().split()))

i2.sort(reverse=True)

if i[1] >= i[0]:
    print("0")
else:
    del i2[:-i[0]+i[1]]
    print(sum(i2))

Solution (Python):
import numpy as np
N, K = map(int, input().split())
H = np.array([int(i) for i in input().split()], dtype='u8')
if K > 0:
    print(np.sum(np.sort(H)[:-K]))
else:
    print(np.sum(H))

Solution (Python):
def LI():
  return [int(s) for s in input().split()]

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

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

H_sort = sorted(H,reverse = True)
print(sum(H_sort[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_L = list(map(int,input().split()))

h_L.sort(reverse=True)

if k ==0:
    print(sum(h_L))
else:
    print(sum(h_L[k:]))

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_sorted = sorted(h)

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

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

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

sortedmylist=sorted(mylist, reverse=True)



if N<=K:
    print(0)
    
else:
    del sortedmylist[:K]
    
    print(sum(sortedmylist))

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

h_list.sort(reverse=True)
attack_num = 0
for i in range(len(h_list) - k):
    attack_num += h_list[k + i]

print(attack_num)

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

h = sorted(h, reverse=True)
ans = 0
if k >= n:
    print(ans)
else:
    for i in range(k, n):
        ans += h[i]
    print(ans)

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

Solution (Python):
import bisect

n, k = map(int, input().split())
l = sorted(map(int, input().split()))

c = len(l) - k
if c < 0:
    c = 0
    
print(sum(l[:c]))

Solution (Python):
import sys
import math
from collections import deque
input = sys.stdin.readline
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):
b,k=map(int,input().split())
h=list(map(int,input().split()))
h=sorted(h)
if k==0:
    print(sum(h))
else:
    print(sum(h)-sum(h[-k:]))

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

print(result)

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

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

del H[:K]

if len(H) == 0:
    print(0)
else:
    print(sum(H))

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

count = sum(sorted(H_list, reverse=True)[K:])

print(count)

Solution (Python):

import heapq
N,K=map(int,input().split())
H=list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(H)
ans=0
if K>=N:
    ans=0
else:
    for i in range(K):
        a=heapq.heappop(H)
    ans=-1*sum(H)
print(ans)

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

def main():
    N, K = input().split()
    N = int(N)
    K = int(K)
    monster = list(map(int, input().split()))
    monster = sorted(monster, reverse=True)
    print(sum(monster[K:]))


if __name__ == "__main__":
    main()

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

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

Solution (Python):
import sys
import numpy as np

input = sys.stdin.readline

N, K = list(map(int, input().split()))
H = np.sort(np.array(list(map(int, input().split()))))[::-1]

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

print(np.sum(H[K:]))

Solution (Python):
a, b = map(int, input().split())
array = list(map(int, input().strip().split()))
array_sort = sorted(array)
out = 0 if a <= b else sum(array_sort[0:a-b])
print(out)

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

Solution (Python):
import sys

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

if H <= A:
    print(0)
    sys.exit()

sli = sorted(li, reverse=True)

print(sum(li) - sum(sli[:A]))

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

Solution (Python):

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


H_list = list(map(int, input().split()))
H_list = sorted(H_list, reverse=True)


H_list = H_list[K:]


HP_sum = sum(H_list)

print(HP_sum)

Solution (Python):
def  fenec(N,K,H):
    H.sort()
    try :
        for i in range (K):
            H.pop()
    except:
        return 0
    rest_hp  = sum(H)
    
    return rest_hp        
8 


inp = input().split()
inp_ = input().split()
N = int(inp[0])
K = int(inp[1] )
H= [int(i) for i in inp_]

print(fenec(N,K,H))

Solution (Python):
N, K = map(int, input().split())
Hs = list(map(int, input().split()))
Hs.sort()
for _ in range(K):
  if len(Hs)==0:
    break
  Hs.pop(-1)
print(sum(Hs))

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

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

Solution (Python):
n, k = map(int, input().split())
his = list(map(int, input().split()))
his_sort = sorted(his)
an = 0
if k > 0:
  for i in range(k):
    his_sort.pop()
    if len(his_sort) == 0:
      break
if len(his_sort) > 0:
  for j in range(n - k):
    an += his_sort[j]
print(an)

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

if len(H) <= K:
    print(0)
    exit()

sort_H = sorted(H)
for i in range(K):
    sort_H.pop(-1)

sm = sum(sort_H)

print(sm)

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)
if len(h)<=k:
    print(0)
else:
    del h[0:k]
    print(sum(h))

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

H = sorted(H)
if k >= n:
  print(0)
  sys.exit()

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

Solution (Python):
H,K = input().split()
H = int(H)
K = int(K)
A = list(map(int, input().split()))
A.sort()
if not K == 0 :
    del A[-K:]
print(sum(A))

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

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

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

if k >= n:
  print(0)

elif k==0:
  print(sum(h))

else:
  h.sort()
  del h[-k:]
  print(sum(h))

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

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

h.sort(reverse=True)


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

print(sum)

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

H.sort()

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

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