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(reverse=True)
if N < K:
    K = N
for i in range(K):
    H[i] = 0

ans = sum(H)
print(ans)

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

H.sort()

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

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
def input():
    return sys.stdin.readline()[:-1]

N,K = map(int,input().split(' '))
l = list(map(int, input().split()))
L = sorted(l, reverse=True)
cnt = 0

for i in range(N):
    k = L[i]
    if i<K:
        continue
    cnt += k
print(cnt)

Solution (Python):
h,k = map(int, input().split(' '))
h = list(map(int, input().split(' ')))
h = sorted(h
)
for i in range(k):
    if h == []:
        break 
    h.pop()
print(sum(h))

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

h = sorted(h, reverse=True)

ans = 0
cnt = 0

for i in h:
    cnt += 1
    if cnt <= k:
        continue
    else:
        ans += i

print(ans)

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys

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

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

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

h.sort()
for i in range(min(k,n)):
    h.pop()
print(sum(h))

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

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

H.sort()

print(sum(H[:hLen-K]))

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

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

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

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

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

    h.sort()
    if k >= n:
        print(0)
        return
    for i in range(1,k+1):
        h.pop(-1)
    print(sum(h))
if __name__=='__main__':
    main()

Solution (Python):
import numpy as np

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

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

print(ans)

Solution (Python):
''' Hey stalker :) '''
INF = 10**10
def main():
    print = out.append
    ''' Cook your dish here! '''
    n, k = get_list()
    li = get_list()
    li.sort(reverse=True)
    
    res = sum(li[k:])
    print(res)



''' Pythonista fLite 1.1 '''
import sys




input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()

print(*out, sep='\n')

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

H.sort()
sm=0

for tmp in range(len(H)-k):
    sm+=H[tmp]

print(sm)

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

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

    hit_list.sort(reverse=True)

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

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

    print(sum(hit_list))

if __name__ == '__main__':
    main()

Solution (Python):

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

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

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

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, os
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 functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N, K = MAP()
    H = LIST()
    if N <= K:
        print(0)
        sys.exit()

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


if __name__ == '__main__':
    main()

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

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

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

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

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

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

Solution (Python):
num_monster, num_trick = map(int, input().split())
hps = list(map(int, input().split()))

hps.sort(reverse=True)
to_attack = hps[num_trick:]

print(sum(to_attack))

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

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

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

Solution (Python):

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

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

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

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

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

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

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

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

Solution (Python):
inputs = input().split(" ")
n = int(inputs[0])
k = int(inputs[1])
h = input().split(" ")
for i in range(n):
    h[i] = int(h[i])
h = sorted(h)[::-1]

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

print(all)

Solution (Python):
from sys import stdin




def ii(): return int(stdin.readline())


def fi(): return float(stdin.readline())


def mi(): return map(int, stdin.readline().split())


def fmi(): return map(float, stdin.readline().split())


def li(): return list(mi())


def lsi():
    x=list(stdin.readline())
    x.pop()
    return x


def si(): return stdin.readline()


def sieve(x):
    a=[True]*(x+1)
    sq=floor(sqrt(x))
    for i in range(3, sq+1, 2):
        if a[i]:
            for j in range(i*i, x+1, i):
                a[j]=False
    if x>1:
        p=[2]
    else:
        p=[]
    for i in range(3, x+1, 2):
        if a[i]:
            p.append(i)
    return p



n, m=mi()
a=li()
a.sort(reverse=True)
m=min(n, m)
print(sum(a[m:]))

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

h.sort(reverse=True)

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

print(sum(h[k:]))

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

h.sort()

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

Solution (Python):
from sys import stdin
n, k = map(int, stdin.readline().rstrip().split())
hp = list(map(int, stdin.readline().rstrip().split()))
hp.sort(reverse=True)
print(sum(hp[k:]))

Solution (Python):
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]


N, K = fetch_int_input()
hps = fetch_int_input()

sort_hps = sorted(hps, reverse=True)

remain_hps = sort_hps[K:]
print(sum(remain_hps))

Solution (Python):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for i in range(k):
    a.pop()
    if len(a)==0:
        break
print("0" if len(a)==0 else sum(a))

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 = map(int, input().split())
h = sorted(h, reverse=True)
if len(h) <= k:
    print(0)
else:
    print(sum(h[k:]))

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

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

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

x = min(k,n)
print(sum(a[x:]))

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok


def main():
    N,K=mis()
    H=lmis()
    H.sort(reverse=True)
    print(sum(H[K:]))

main()

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

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

Solution (Python):

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

h_sort = sorted(h, reverse=True)

print(sum(h_sort[k:]))

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

Solution (Python):
import sys
sys.setrecursionlimit(4100000)

import math

import logging

logging.basicConfig(level=logging.DEBUG)

logger = logging.getLogger(__name__)


def resolve():
    
    
    N, K = [int(x) for x in sys.stdin.readline().split()]  
    h_list = [int(x) for x in sys.stdin.readline().split()]  

    
    
    

    logger.debug('{}'.format([]))

    h_list = sorted(h_list, reverse=True)

    if len(h_list) <= K:
        print(0)
    else:
        print(sum(h_list[K:]))


if __name__ == "__main__":
    resolve()





import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 1
4 1 5"""
        output = """5"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """8 9
7 9 3 2 3 8 4 6"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """3 0
1000000000 1000000000 1000000000"""
        output = """3000000000"""
        self.assertIO(input, output)

Solution (Python):
A,B=map(int,input().split())
C=list(map(int,input().split()))
C.sort(reverse=True)
print(sum(C[B:]))

Solution (Python):
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

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

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

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

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

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

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

Solution (Python):
n, k = map(int, input().split())
h_array = list(map(int, input().split()))
h_array.sort()
for _ in range(min(k, n)):
    h_array.pop()
print(sum(h_array))

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

Solution (Python):
N,K = map(int,input().split())
h = [int(s) for s in input().split()]
t = sorted(h,reverse = True)
p = t[K:N]
s = sum(p)
print(s)

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

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

Solution (Python):
n,k = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a)
a = a[::-1]
s=0
for i in range(min(k,n),n):
    s+=a[i]
print(s)

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=1)
ans=0
for x in h:
  if k>=1:
    k-=1
  else:
    ans+=x







print(ans)

Solution (Python):

''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/g.inp"
exit $?
'''
import sys


def _ia(): return [int(x) for x in sys.stdin.readline().strip().split()]


def main():
    n, k = _ia()
    h = _ia()
    if n <= k:
        return 0

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


print(main())

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

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

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

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

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

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

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

H = sorted(H, reverse=True)
if len(H) <= K:
    print(0)

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

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

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

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

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


if __name__ == '__main__':
    resolve()

Solution (Python):
def solve(n, k, h_list):
    h_list_s = list(sorted(h_list))
    if k >= n:
        return 0
    elif k > 0:
        return sum(h_list_s[:-k])
    else:
        return sum(h_list_s)


def main():
    n, k = map(int, input().split())
    h_list = list(map(int, input().split()))
    res = solve(n, k, h_list)
    print(res)


def test():
    assert solve(3, 1, [4, 1, 5]) == 5
    assert solve(8, 9, [7, 9, 3, 2, 8, 4, 6]) == 0
    assert solve(3, 0, [1000000000, 1000000000, 1000000000]) == 3000000000


if __name__ == "__main__":
    test()
    main()

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

Solution (Python):
import sys

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

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

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

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

print(count)

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

n = sum(h[k:])

print(n)

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

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

H = sorted(H)[::-1]
cnt = 0
for i in range(min(K, N), N, 1):
    cnt += H[i]

print(cnt)

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

A = sorted(map(int, input().split(" ")), reverse=True)

print(sum(A[K:]))

Solution (Python):
from sys import stdout
printn = lambda x: stdout.write(str(x))
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True 
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

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


H.sort(reverse=True)

ans = 0

for i in range(K, len(H), 1):

    ans = ans + H[i]

print(ans)

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

H = H[K:]


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

Solution (Python):
from sys import stdin

if __name__ == '__main__':
    n, k = [int(x) for x in stdin.readline().rstrip().split()]
    H = [int(x) for x in stdin.readline().rstrip().split()]
    H.sort(reverse=True)
    H = H[k:]
    totalAttack = sum(H)
    print(totalAttack)

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)
for i in range(0,min(k,len(h))):
    h[i] = 0
hp = 0
for j in range(k,n):
    hp += h[j]

print(hp)

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

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 == 0:
    print(sum(H))
    exit()

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

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

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

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

H=sorted(H)[::-1][K:]
print(sum(H))

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

if k >= n:
    print(0)

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

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


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

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

nlist.sort(reverse=False)

for i in range (b):
    if len(nlist) == 0:
        break
    nlist.pop()

print(sum(nlist))

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

print(sum(hList[k:]))

Solution (Python):
import sys


def main():
    n_and_k_s = sys.stdin.readline().strip().split(' ')
    n, k = [int(s) for s in n_and_k_s]
    h = [int(s) for s in sys.stdin.readline().strip().split(' ')]

    h.sort(reverse=True)

    total = 0
    special = 0
    for i in range(len(h)):
        if special < k:
            special += 1
            continue
        total += h[i]
    print(total)


if __name__ == '__main__':
    main()

Solution (Python):

import sys


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

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    K = int(next(tokens))  
    H = [int(next(tokens)) for _ in range(N)]  
    solve(N, K, H)

if __name__ == '__main__':
    main()

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

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

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

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

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

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

H.sort(reverse=True)

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

Solution (Python):
n, k = map(int, input().split())
H = sorted(map(int, input().split()))
if k >= len(H):
    print(0)
else:
    for _ 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)
del H[:min(N,K)]
print(sum(H))

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

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


if __name__ == '__main__':
    main()

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

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

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

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

if __name__ == '__main__':
    main()

Solution (Python):
import sys

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

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

HList.sort()

result = 0
for i in range(N - K - 1, -1, -1):
    result += HList[i]
    

print(result)

Solution (Python):
import collections
import math
import operator as op
from functools import reduce
import numpy as np
import math
import bisect
import heapq


MOD = 1000000007


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    return a * b // gcd(a, b)


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def is_prime(n):
    if n == 1:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


def main():
    N, K = get_inputs(int)
    H = get_inputs(int)

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


if __name__ == '__main__':
    main()

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)

print(sum(H[K:]))

Solution (Python):
import math

def intinput():
    return int(input())

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

def splitintinput():
    return map(int,input().split())

ans = 0
N,K = splitintinput()
H = listintinput()
H.sort(reverse=True)
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()

for i in range(K):
    if len(H) == 0:
        break
    H.pop()

count = sum(H)
print(count)

Solution (Python):
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    n,k=MI()
    h=LI()
    h.sort()
    if n<=k:
        print(0)
    else:
        x=n-k
        s = sum(h[:x])
        print(s)

if __name__ == "__main__":
    main()

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

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

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

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

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

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

Solution (Python):
if __name__ == '__main__':
    b, c = map(int, input().split())
    a = [int(i) for i in input().split()]
    a.sort(reverse=True)
    count = 0

    for i in a:
        if c >=1:
            c = c -1
        else:
            count = count + i
    print(count)

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

main()

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

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

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) 

def LI(): return list(map(int, sys.stdin.readline().split()))

N, K = LI()
H = LI()
H.sort()
ans = 0
if K >= len(H):
    print(0)
    sys.exit()

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

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


main()

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

List.sort()
attack = 0
enemy = N - K

for i in range(enemy):
    attack += List[i]

print(attack)

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

if n <= k:
    print(0)
else:
    h.sort(reverse=True)
    ret = 0
    for i in h[k:]:
        ret += i
    print(ret)