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):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

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

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

print(sum(H[K:N]))

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

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

if n <= k :
    print(0)
else :
    for i in range(k) :
        enemy[i] = 0
    print(sum(enemy))

Solution (Python):
from collections import deque
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
deqH = deque(H)
if N <= K:
    print(0)
else:
    for i in range(K):
        deqH.popleft()
        
        
    print(sum(deqH))

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,*h=map(int,open(0).read().split())
if k>=n:
    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=sorted(H,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()
  print(sum(h[0:n-k]))

Solution (Python):
nMonsters, nSpecial = [int(x) for x in input().split()]

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

monst.sort()

nMonsters -= nSpecial

if nMonsters < 0:
    print(0)
else:
    print(sum(monst[0:nMonsters]))

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()))
h.sort(reverse=True)
print(sum(h[k:]))

Solution (Python):
import sys
N, K = [int(x) for x in input().split()]
H = [int(x) for x in input().split()]
H.sort()
if(N<K):
  print(0)
  sys.exit()
else:
  for i in range(1,K+1):
    H[N-i] = 0
print(sum(H))

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

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 = [int(x) for x in input().split()]
Ha = sorted(H, reverse=True)
del Ha[:K]
print(sum(Ha))

Solution (Python):
a,b=map(int, input().split())
c=sorted(list(map(int, input().split())),reverse = True)

ans = 0

if b >= a:
    c = [0]
if b < a:
    for i in range(b):
        c[i] = 0

print(sum(c))

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

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

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

print(m)

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()))
if k>=n:
    print(0)
else:
  H.sort(reverse=True)
  for i in range(k):
    H[i] = 0

  print(sum(H))

Solution (Python):
n,k,*h=map(int,open(0).read().split())
if k>=n:
  print(0)
  exit()
h.sort()
print(sum(h[:n-k]))

Solution (Python):
n,k,*h=map(int,open(0).read().split())
if k>=n:
  print(0)
  exit()
h.sort(reverse=True)
for i in range(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:n]))

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

h=sorted(h,reverse=True)

s=h[k:]

print(sum(s))

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

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

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

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

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

(n, k), s, c = map(int, input().split()), sorted(list(map(int, input().split())), reverse = True), 0
for i in range(n-k): c += s.pop()
print(c)

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

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

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

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

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

h.sort(reverse=True)

if k == 0 :
    print(sum(h))
elif k <= n :
    for i in range(k):
        h[i] = 0
    print(sum(h))
else :
    print(0)

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

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


s=0
if k>=n:
    s=0
    print(s)
else:
    c=merge_sort(h)
    c.reverse()

    s=0
    for a in range(n-k):
        s=s+c[a+k]
    
    print(s)

Solution (Python):
import sys

n,k = map(int,input().split())
ans = 0;
h = [int(x) for x in input().split()]
h.sort(reverse = True)
h = h[k:]

if len(h) > 0:
    ans += sum(h)

print(ans)

Solution (Python):
n,k = map(int,input().split())
h = list(sorted(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(' '))
l=list(map(int, input().split(' ')))
l=sorted(l)
 
print(sum(l[:max(n-k,0)]))

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

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

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

h.sort(reverse = True)
t = 0

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

Solution (Python):
from sys import exit

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

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

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)

remainder = H[K:]

print(sum(remainder))

Solution (Python):
if __name__ == '__main__':

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

	num = len(A) - min(n,k)

	print(sum(A[0:num]))

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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

ans = 0
h.sort(reverse=True)
for i in h:
    if 0 < k: k -= 1
    else:
        ans += i

print(ans)

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

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

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

Solution (Python):

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

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

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

if n <= k:
    print(0)
    exit()
ans = 0
for h in H[: n - k]:
    ans += 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()))

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

print(rh2)

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, K, *H = map(int, read().split())
    
    H.sort(reverse=True)
    print(sum(H[K:]))
    
    return


if __name__ == '__main__':
    main()

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

remainHlist = Hlist[K:]
attackTimes = sum(remainHlist)
print(attackTimes)

Solution (Python):
import math

def main():
  N, K = map(int, input().split())
  H = list(map(int, input().split()))
  
  if K >= N:
    print(0)
    return
  
  
  l = sorted(H, reverse=True)
  
  
  
  
  
  
  print(sum(l[K:]))
  
  
  
main()

Solution (Python):
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


def main():
    N, K = MI()
    H = LI()
    Hs = sorted(H)
    ans = 0

    if N > K:
        for i in range(N-K):
            ans += Hs[i]
        print(ans)
    else:
        print(0)

if __name__ == "__main__":
	main()

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

print(sum(mon[k:]))

Solution (Python):
import sys

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

if K>=N:
  print(0)
  sys.exit(0)
  
H.sort(reverse=True)
del H[0:K]
for i in range(len(H)):
  ans+=H[i]
print(ans)

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

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

h.sort()

s = min(k, n)
if s:
    answer = sum(h[:-s])
else:
    answer = sum(h)
print(answer)

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

print(count)

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

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

H.sort()
H.reverse()
print(sum(H)-sum(H[0:k]))

Solution (Python):
n,k=map(int,input().split())
h=sorted(list(map(int,input().split())))
ans = 0
if k >= n:
  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()

h = h[::-1]
h = h[k:]

ans = sum(h)

print(ans)

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

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

print(ans)

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

    if k >= n:
        print(0)
        exit()
    elif k > 0:
        total = sum(inlis[:-k])
    elif k == 0:
        total = sum(inlis)
    print(total)

    
if __name__ == "__main__":
    main()

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

Solution (Python):
import sys












stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
MIN = -10 ** 9
MOD = 10 ** 9 + 7
INF = float("inf")
IINF = 10 ** 18

def solve():
    
    n,k = map(int, stdin.readline().rstrip().split())
    H = list(map(int, stdin.readline().rstrip().split()))
    
    
    
    
    H.sort()
    if n <= k:
        print(0)
        exit()

    for i in range(k):
        H.pop(-1)

    print(sum(H))

if __name__ == '__main__':
    solve()

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

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

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

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

Solution (Python):
N,A=map(int,input().split())
B=sorted(list(map(int,input().split())))
for j in range(A):
    if B!=[]: B.pop()
print(sum(B))

Solution (Python):









import os
import sys




def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    if n<=k:
        print(0)
        return
    h.sort()

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



if __name__ == "__main__":
    main()

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

A.sort()

SUM = 0
for i in range(N - K):
    SUM += A[i]

print(SUM)

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

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

Solution (Python):
import sys

n, k = map(int, input().split())
hn = sorted(list(map(int, sys.stdin.readline().split())), reverse=True)

ans = sum(hn[k:])
print(ans)

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

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


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):
import heapq
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())
Hs = list(map(int, input().split()))

Hs.sort(reverse=True)

ans = sum(Hs[K:])
print(ans)

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

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

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

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

print(sum(M[K:]))

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

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

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

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

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

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

print(sum_at)

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

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

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

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

H = sorted(H, reverse = True)

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

print(ans)

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

hl.sort(reverse=True)

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

rem_hl = hl[k:]
rem_sum = sum(rem_hl)
print(rem_sum)

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

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

if __name__ == '__main__':
    main()

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,*l=map(int,open(0).read().split())
print([0,sum(sorted(l)[:n-k])][n>k])

Solution (Python):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque


from collections import Counter

from itertools import accumulate,combinations,permutations

from heapq import heapify,heappop,heappush


from functools import lru_cache

from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    

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




if __name__ == "__main__":
    main()

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()))
if k>=n:
    print(0)
else:
    h.sort(reverse=True)
    for i in range(k):
        h[i]=0
    print(sum(h))

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

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

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

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

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

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

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

H.sort(reverse=True)

H=H[K:]

H_cumsum=[0]
H_sum_=0
for n in range(len(H)):
    H_sum_=H_sum_+H[n]
    H_cumsum.append(H_sum_)
print(H_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 = (int(x) for x in input().split())
H   = sorted([int(x) for x in input().split()])
if K>=len(H):
    print('0')
else:
    print(sum(H[:len(H)-K]))

Solution (Python):

def main():
    N, K = map(int,input().split())
    H = list(map(int,input().split()))
    H.sort()
    H.reverse()
    H = H[K:]
    cost = 0
    for i in H:
        cost+=i
    print(cost)
main()

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

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

hi=sorted(h)
if k:
  print(sum(hi[:-k]))
else:
  print(sum(hi))

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

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

H.sort()
print(sum(H[:max(N-K,0)]))

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

H.sort()
H.reverse()

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

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

Solution (Python):
from sys import exit

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

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

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

s_h = sorted(h, reverse=True)

a_h = s_h[k:]

ans = sum(a_h)

print(ans)

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

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

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

H=sorted(h,reverse=True)
if K>=N:
    print(0)
    exit()

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

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

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

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

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

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

if(K >= N):
  ans = 0
else:
  while(i<K):
    l[N-i-1] = 0
    i += 1
  ans = sum(l)
print(ans)

Solution (Python):
n,k = map(int,input().split())
H= list(map(int,input().split()))
if(k<n):
  H.sort()
  for i in range(k):
    H.pop()
  cont=0
  for i in range(len(H)):
    cont+= H[i]
  print(cont)
else:
  print(0)

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

h.sort()

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

H = sorted(H,reverse = True)

print(sum(H[K:]))

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

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

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

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

H = H[K:]

print(sum(H))

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

Solution (Python):

import sys

sysread = sys.stdin.readline
read = sys.stdin.read
sys.setrecursionlimit(10 ** 7)










def run():
    N, K = map(int, input().split())
    H = list(map(int, sysread().split()))
    H = sorted(H)
    if N <= K:
        print(0)
        return None
    elif K == 0:
        print(sum(H))
        return None
    else:
        print(sum(H[:-K]))

if __name__ == "__main__":
    run()

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

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

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

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

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

H_list = list(reversed(sorted(H_list)))

H_list = H_list[K:]

print(sum(H_list))

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

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

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

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

def main():
    n, k = map(int, input().split())
    h = sorted([int(i) for i in input().split()])
    for _ in range(k):
        h.pop()
        if h == []:
            print(0)
            return
    print(sum(h))

if __name__ == '__main__':
    main()

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

S.sort()
S.reverse()


goukei=0
pos=0

while pos<K:
    S[pos]=0
    pos+=1
    if pos>=N:
        break

for i in range(N):
    goukei+=S[i]
print(goukei)

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

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

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

l=sorted(h,reverse=True)

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

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

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

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

h.sort()

cnt = 0

for i in range(k):
  h.pop()
  if not h:
    break
  
for i in h:
  cnt += i

print(cnt)

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

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

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

Solution (Python):

n, k, *h = map(int, open(0).read().split())
a = 0
h.sort()
for i in range(n-k):
    a += h[i]
print(a)

Solution (Python):
array = []

for i in range(2):
    val = input().split()
    array.append(val)

n = int(array[0][0])
k = int(array[0][1])
h = sorted([int(s) for s in array[1]], reverse=True)

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

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
for m in range(min(k,n)):
  h[-m-1]=0
print(sum(h))

Solution (Python):
import sys
N,M=map(int,input().split())
L=list(map(int,input().split()))
if N<=M:
  print(0)
  sys.exit()
L=sorted(L,reverse=True)
print(sum(L[M:N]))

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

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

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

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

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

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

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

if len(monsters) <= K:
    print('0')
else:
    monsters.sort(reverse=True)
    print(sum(monsters[K:]))