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()

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

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

A.sort()
if N > K:
  for i in range(K):
    A.pop()
  print(sum(A))
else:
  print("0")

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

print(sum(HL[K:]))

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

li=sorted(li,reverse=True)
sum_=sum(li)
for i in range(m):
  if i>=len(li):
    break
  sum_-=li[i]
print(sum_)

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

Solution (Python):
import numpy as np

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

H = np.sort(np.array(H))[::-1]
H = H[min(K, H.shape[0]):]

print(np.sum(H))

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

Solution (Python):
def attack(n, k, H):
  H.sort(reverse = True)
  sum = 0
  for i in range(k, n):
    sum += H[i]
  return sum

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

Solution (Python):
N, K = map(int, input().split())
H = sorted(map(int, input().split()))
if N < K:
    K = N
for _ in range(K):
    H.pop(-1)
print(sum(H))

Solution (Python):


import sys

def main():
    n, k = [int(x) for x in sys.stdin.readline().split()]
    hs = [int(x) for x in sys.stdin.readline().split()]

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

if __name__ == '__main__':
    main()

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

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

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

print(HAS-HHA)

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

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

h = sorted(h, reverse=True)

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

print(ans)

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

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

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

A = list(reversed(sorted(A)))[k:]

print(sum(A))

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

Solution (Python):
import numpy as np
from sys import stdin
from copy import deepcopy
from functools import reduce
from fractions import gcd
import math
import itertools
from collections import Counter
from itertools import chain  
from heapq import heappush, heappop

"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) 
A = [int(input()) for _ in range(N)] 
lst = [list(map(int,input().split())) for i in range(M)] 
"""

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

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

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

print(ans)

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

if K==0:
  print(sum(H))
  exit()
  
H.sort()
del H[-K:]
print(sum(H))

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

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

Nlife = sorted(life, reverse=True)


if K >= 1:
  del Nlife[:K]
  

answer = sum(Nlife)

print(answer)

Solution (Python):
special_moves = input().split(" ")

_, special_moves = int(special_moves [0]), int(special_moves [1])

health= input().split(" ")
health= [int(h) for h in health]
health.sort(reverse=True)
print(sum(health[special_moves:]))

Solution (Python):
inputs = input().split(" ")

monsters_num, special_moves = int(inputs[0]), int(inputs[1])

health_inp = input().split(" ")
monsters_health = [int(h) for h in health_inp]
monsters_health.sort(reverse=True)
print(sum(monsters_health[special_moves:]))

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

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

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

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

Solution (Python):
import math

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

h = sorted(H)
i = len(H)-K

if K <= N: 
	H_count = sum(h[:i])
	print(H_count)
else:
	print(0)

Solution (Python):
a,b=map(int,input().split())
c=list(map(int,input().split()))
c.sort()
e=0
i=0
while i<a-b:
    e=e+c[i]
    i=i+1
print(e)

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

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

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

if K < N:
    H_sorted = sorted(H, reverse=True)
    print(sum(H_sorted[K:]))
else:
    print(0)

Solution (Python):
listA=[]

for i in range(2):
    try:
        listA.append(list(map(int, input().split())))
        
        
        
    except:
        break;
        

N=(listA[0])[0]
K=(listA[0])[1]
listf=listA[1]

listf.sort()

if N-K>=1:
    print(sum(listf[0:N-K]))
else:
    print(0)

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

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

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

Solution (Python):
import sys


def InS(): return input()


def InL(): return list(map(int, input().split()))


def InI(): return int(input())


N, K = InL()
H = InL()
H.sort()

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

Solution (Python):
def get_input_line():
    return list(map(int, input().split()))
n, k = get_input_line()
h_list = get_input_line()
h_list.sort()
h_list.reverse()

print(sum(h_list[k:]))

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

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

h.sort()
ans = 0

if n <= k:
    h.clear()
else:
    for i in range(k):
            h.pop(-1)

print(sum(h))

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

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

Solution (Python):
enemy_count, skills = map(int,input().split())
enemies = list(map(int,input().split()))
enemies.sort()
if skills != 0:del enemies[-1*skills:]
print("%d"%sum(enemies))

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

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

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

sum = 0
for i in range(K, len(H)):
    sum += H[i]

print(sum)

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

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

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

Solution (Python):
import math
query=[int(x) for x in input().split()]
N = query[0]
K = query[1]
l=[int(x) for x in input().split()]
l.sort(reverse=True)
sum=0
for i in range(K,N):
    if i<N:
        sum=sum+l[i]
print(sum)

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

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

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

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

Solution (Python):
def attack(h, k, arr):
    arr.sort()
    if h - k > 0:
        return sum(arr[0:h-k])
    else:
        return 0

if __name__ == "__main__":
    h, k = map(int, input().split())
    arr = list(map(int,input().split()))
    print(attack(h, k, arr))

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

answer = 0
if N > K:
    H.sort()
    for i in range(N - K):
        answer += H[i]

print(answer)

Solution (Python):

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

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

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


h.sort()


i=1
try:
    while i<=k:
       h[-i]=0
       i+=1
except:
    pass


i=0
ans=0
while i<n:
    ans+=h[i]
    i+=1
print(ans)

Solution (Python):
nk = input().strip().split()
k = int(nk[1])
h = [int(i) for i in input().strip().split()]
h.sort(reverse=True)

print(sum(h[k:]))

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

Solution (Python):
import itertools
import sys
import math
import numpy as np
from collections import deque
from itertools import combinations
from functools import lru_cache
sys.setrecursionlimit(10**9)


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

    target_count = len(H) - K
    sum = 0
    for i in range(target_count):
        sum += H_sorted[i]

    print(sum )


if __name__ == "__main__":
  main()

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

H.sort()

count = 0

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

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

H.sort()

if N <= K:
    min = 0
else:
    min = 0
    left = N - K
    for i in range(left):
        min += H[i]

print(min)

Solution (Python):

n,k = map(int, input().split())
h = []
count = 0

for i in map(int, input().split()):
  h.append(i)

hr = sorted(h, reverse=True)

for l in range(n):
  if l >= k:
    count += hr[l]
print(count)

Solution (Python):






import math
import statistics
import numpy as np
import queue

h,k = map(int, input().split())
h = np.array(sorted(list(int(i) for i in input().split()), \
      reverse = True))

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

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

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

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

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

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

print(sum(h))

Solution (Python):
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()))

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

print(result)

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

Solution (Python):
n, k = (int(z) for z in input().split())
a = [int(z) for z in input().split()]
a.sort()
sm = 0
for i in range(n - k):
  sm += a[i]
print(sm)

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

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

print(ans)

Solution (Python):


fennec = input().split(" ")
N = int(fennec[0])
K = int(fennec[1])
enemys = input().split(" ")
enemys_int = [int(s) for s in enemys]
enemys_int.sort()
ans = 0
if K < N:
    if K == 0:
        for i in enemys_int:
            ans += int(i)
        print(ans)
    else:
        del enemys_int[-K:]
        for i in enemys_int:
            ans += int(i)
        print(ans)
else:
	print("0")

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

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

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

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

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

if K >= N:
    print(0)
else:
    s = 0
    for i in range(0,N-K):
        s = s + J[i]
    print(s)

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

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

h2 = sorted(h,reverse=True)

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

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

print(sum(h[k:]))

Solution (Python):
n,k = map(int, input().split())
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)

ans = 0
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.sort(reverse=1)
if n <= k:
    print(0)
else:
    print(sum(h[k:]))

Solution (Python):
enemy_num, dethblow_num, *enemy_hp = map(int, open(0).read().split())

if enemy_num >= dethblow_num:
    enemy_hp.sort(reverse=True)
    del enemy_hp[:dethblow_num]
else:
    enemy_hp.clear()
    enemy_hp = [0]
    
print(sum(enemy_hp))

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

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

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

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

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

H.sort()
H.reverse()

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):
import sys

I = list(map(int, input().split()))
H_i = list(map(int,input().split()))
H_i = [i for i in H_i if 1 <= i and i <= 10**9]
N = I[0] 
K = I[1] 

if not 0 <= K or not K <= 2*10**5 or not 1 <= N or not N <= 2*10**5:
    print("error")
    sys.exit()

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

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

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

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

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

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

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

del H[:K]

print(sum(H))

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

if n<=k:
    number = 0
elif 0<k<n:
    h_lst.sort()
    number = sum(h_lst)-sum(h_lst[-k:])
elif k==0:
    number = sum(h_lst)

print(number)

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

Solution (Python):
def main():
	x = [int(i) for i in input().split()]
	y = [int(i) for i in input().split()]
	y.sort()
	if (x[1]!=0):
		z = y[:-x[1]]
	else:
		z = y
	print(sum(z))
if __name__== "__main__":
	main()

Solution (Python):
import sys
sys.setrecursionlimit(int(1e6))

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

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

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

    H.sort(reverse=True)
    if K != 0 :
        h = H[K:]
        print(sum(h))
    else:
        print(sum(H))
resolve()

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

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

for _ in range(min(k, len(h_list))):
    h_list.pop()
for h in h_list:
    sum += h
print(sum)

Solution (Python):
import sys
n, k = [int(i) for i in sys.stdin.readline().split()]
k = min(k, n)
h_ls = [int(i) for i in sys.stdin.readline().split()]
h_ls.sort()
print(sum(h_ls[:n-k]))

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 = map(int,raw_input().strip().split())
a = map(int,raw_input().strip().split())
a.sort()
if n<=k:
    print 0
else:
    arr = a[:n-k]
    print sum(arr)

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

Solution (Python):
Input = input().split(" ")
N = int(Input[0])
K = int(Input[1])
Input2 = input().split(" ")
enemys = sorted([int(A) for A in Input2], reverse=True)
if N<=K:
  print(0)
else:
  print(sum(enemys[K:]))

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


if N<=K:
    print(0)
else:
    ListH.sort()
    sum=0
    for i in range(N-K):
        sum+=ListH[i]

    print(sum)

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)
print(sum(H[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 permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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()

print(sum(sorted(H, reverse=True)[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 permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
from bisect import bisect

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()

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

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

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

Solution (Python):



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


l = list(map(int, input().split()))
l.sort()
l.reverse()


if n <= k:
    print("0")
else:
    print("{}".format(sum(l[k:])))

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

list_H.sort()

while K :
    if list_H :
        list_H.pop()
    K -= 1

print(sum(list_H))

Solution (Python):


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

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

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

m =sorted(l,reverse=True)

n = m[k:]

print(sum(n))

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

atk = 0

Hps = [int(x) for x in input().split()]

Hps.sort()

bsp = []
for sp in reversed(Hps):
    if K > 0:
        K -= 1
    else:
        bsp.append(sp)

for x in bsp:    
    atk += x

print(atk)

Solution (Python):
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys






read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
INF = 10 ** 9

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

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

Solution (Python):
def main():
    n,k=map(int,input().split())
    H=list(map(int,input().split()))
    if n<=k:
        return 0
    H.sort(reverse=True)
    return sum(H[k:])
    
if __name__=='__main__':
    print(main())

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

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

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()))

list.sort(H, reverse=True)
for i in range(N):
    if i<=K-1:
        H[i] = 0

print(sum(H))

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

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

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

Solution (Python):
NK = input().split()
N = int(NK[0])
K = int(NK[1])
Hs = input().split()
Hs = [int(h) for h in Hs]

import numpy as np
Hs = np.array(Hs)
Hs = np.sort(Hs, kind="quick_sort")
if K > 0:
  s = np.sum(Hs[0:-K]) if N > K else 0
else:
  s = np.sum(Hs)
print(s)

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

Solution (Python):
from sys import stdin, stdout

def main():
	N, K = (int(x) for x in stdin.readline().split())
	health = [int(x) for x in stdin.readline().split()]
	health.sort()
	for _ in range(min(len(health), K)):
		health.pop()
	stdout.write(str(sum(health)))

if __name__ == "__main__":
	main()

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

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

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

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

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

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

if k > n:
    k = n
h.sort(reverse=True)
for i in range(k):
    h[i] = 0

print(sum(h))

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

def merge_sort(arr):
    if len(arr) <= 1:
        return arr

    mid = len(arr) // 2
    
    left = arr[:mid]
    right = arr[mid:]

    
    left = merge_sort(left)
    right = merge_sort(right)

    
    return merge(left, right)


def merge(left, right):
    merged = []
    l_i, r_i = 0, 0

    
    while l_i < len(left) and r_i < len(right):
        
        if left[l_i] <= right[r_i]:
            merged.append(left[l_i])
            l_i += 1
        else:
            merged.append(right[r_i])
            r_i += 1

    
    if l_i < len(left):
        merged.extend(left[l_i:])
    if r_i < len(right):
        merged.extend(right[r_i:])
    return merged

ll = merge_sort(ls)
if n <= k:
    print(0)
else:
    print(sum(ll[:n-k]))

Solution (Python):
li_a = input().split()

li_b = input().split()

li_a = [int(i) for i in li_a]
i = 0
li_b = [int(i) for i in li_b]

li_c = sorted(li_b,reverse=True)

for j in range(li_a[1]):
    if j == len(li_b):
        break
    li_c[j] = 0

print(sum(li_c))

Solution (Python):
import numpy as np

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

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

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

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

Solution (Python):
h,k = map(int,input().split())
a = list(map(int,input().split()))
if k>h or k==h:
    att = 0
else:
    a2 = sorted(a)
    sum = 0
    for i in range(-1,-(k+1),-1):
        sum = sum + a2[i]
    count = 0
    for j in range(0,h,1):
        count = count+a[j]
    lastSum = count-sum
    att = lastSum//1
print(att)

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

H.sort(reverse=True)

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

print(ans)

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

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

total = 0
for i in h:
    if k != 0:
        k-=1
    else:
        total+=i

print(total)

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

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

print(ans)

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

Solution (Python):

def main():
	N, K = map(int, input().split())
	H = [int(_) for _ in input().split()]
	H.sort(reverse=True)
	
	if K>=N:
		print('0')
	else:
		print(sum(H[K:]))
main()

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

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

a.sort()
m = max(n - k, 0)

sum = 0
for i in range(m):
  sum += a[i]

print(sum)

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

    ans = 0
    if N>K : ans = sum(Hi[K:])
    
    print(ans)
    return

if __name__=="__main__":
    main()

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

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

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

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

Solution (Python):
import sys

inputs = sys.stdin.readline()
H = sys.stdin.readline()
inputs = inputs.split()
N, K = int(inputs[0]), int(inputs[1])
H = [int(h) for h in H.split()]
H = sorted(H)[::-1]

count = 0
for h in H[K:]:
    count += h

print(count)

Solution (Python):
N, K = map(int, input().split())
H =  list(map(int, input().split()))
list.sort(H, reverse = True)
ANS = 0
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 len(h) <= k:
	print(0)

else:
	h.sort(reverse = True)

	for i in range(0, 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)
print(sum(h[k:]))

Solution (Python):
from sys import stdin

N,K=map(int,stdin.readline().rstrip().split())
H=sorted(list(map(int,stdin.readline().rstrip().split())))

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

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

H.sort(reverse=True)

print(sum(H[K:]))