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

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

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

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

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

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

H.sort() 

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

print(ans)

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

count = sum(H[K:])

print(count)

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

Solution (Python):
from collections import deque, Counter as cnt
from collections import defaultdict as dd
from operator import itemgetter as ig
from bisect import bisect_right as bsr
from math import factorial, ceil, floor
import sys
sys.setrecursionlimit(1000000)


args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def nlist(n, v):
    if not n:
        return [] if type(v) is list else v
    return [nlist(n[1:], v) for _ in range(n[0])]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N, K = input(int, int)
    H = input([int, N])
    H.sort()
    if N <= K:
        print(0)
        return
    if K == 0:
        print(sum(H))
        return
    print(sum(H[:-K]))


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

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

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

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

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

H = list(map(int, input().split()));


H.sort(reverse=True);
yowa = H[k:];

ans = sum(yowa);

print(ans);

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h=sorted(h)
for i in range(k):
  if len(h)==0:
    break
  del h[-1]
hit=sum(h)
print(hit)

Solution (Python):
N,K=map(int,input().split())
H=list(map(int,input().split()))
if N<K or N==K:
    print(0)
    exit(0)
else:
    list.sort(H)
for n in range(K):
    H.pop()
print(sum(H))

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

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

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

Solution (Python):


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

H=list(map(int,input().split()))
H.sort()


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

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

a = 0
b = 0
if N <= K:
    ans = 0
else:
    a = N - K

H.sort()
for i in range(a):
    b += H[i]
print(b)

Solution (Python):




def input_int():
    return int(input())



def int1(x):
    return int(x) - 1



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



def input_to_int_tuple():
    return tuple(map(int, input().split()))



def input_to_int_tuple_minus1():
    return tuple(map(int1, input().split()))


def main():
    n, k = input_to_int_map()
    h = input_to_int_tuple()

    if n <= k:
        return 0

    h_sorted = sorted(h)
    return sum(h_sorted[:n - k])


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

Solution (Python):
from pprint import pprint
import sys
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N, K = rl()
H = rl()

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

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

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

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

Solution (Python):
from collections import deque

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

if K > len(h):
    print(0)
    exit()

h = deque(sorted(h))

for i in range(K):
    h.pop()

print(sum(h))

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

if k>n:
    k=n
del l[:k]

print(sum(l))

Solution (Python):
import sys

n, k, *h = map(int, sys.stdin.read().split())

def main():
    print(sum(sorted(h)[:max(0, n-k)]))

if __name__ ==  '__main__':
    main()

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

h = sorted(h)

h.reverse()

print(sum(h[k:]))

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

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

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

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

new_arr= sorted(arr, reverse=True)

for i in range(K):
    new_arr[i] = 0

print(sum(new_arr))

Solution (Python):
n,s = map(int, input().split())
l = list(map(int, input().split()))
l.sort()
i = 1
while(s>0 and l[0]>0):
    l[-i] = 0
    s-=1
    i+=1
print(sum(l))

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

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

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

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

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

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

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

monster = H[0:N-K]

if K >= N:
    print(0)
else:
    print(sum(monster))

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

if len(H)<=K:
    ans = 0
else:
    Dmg = sum(H[K:])
    ans = Dmg
print(ans)

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

H.sort(reverse=False)

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

print(sum(H))

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

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

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

Solution (Python):
N,K=map(int,input().split())
H=list(map(int,input().split()))
H=sorted(H)[::-1]
print(sum(H[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=map(int,input().split())
h=sorted(h)
if n<=k:
  print('0')
  exit()
  
for i in range(k):
  h[-i-1]=0
print(sum(h))

Solution (Python):


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

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

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

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

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

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

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

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

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

Solution (Python):
import numpy as np
N,K = map(int,input().split())
H = np.array(list(input().split()),np.int64)
H = np.sort(H)
if K > N:
    K = N
H[N-K:N] = 0
ans = np.sum(H)
print(ans)

Solution (Python):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, k = MI()

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

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

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

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

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

s = 0

h.sort()

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

print(s)

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

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

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

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

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

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

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

print(ans if N > K else 0)

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

print(sum(h[k:]))

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

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

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

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

H.sort(reverse=True)

ans = 0
for i in H:
    if K >= 1:
        K -= 1
        continue
    else:
        ans += i

print(ans)

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

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

H.sort()
H.reverse()
count=0
if K<len(H):
    for i in range(K, len(H)):
        count+=H[i]
print(count)

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

H = sorted(H, reverse=True)

for i in range(min(n, k)):
    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[:N-K]))

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

ans=0
if K<N:
    for i in H[:N-K]:
        ans += i
print(ans)

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

Solution (Python):
N,K=map(int,input().split())
H=[int(i) for i in input().split()]
H.append(0)
H.sort()
if K>N:
  print(0)
else:
  for _ in range(K):
    H.pop()
  print(sum(H))

Solution (Python):

import sys



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

H.sort()
H = H[::-1]


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

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

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

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

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

x = 0

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

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 accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, K = MAP()
H = LIST()

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

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

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

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

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

    print(ans)

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

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

else:
  print(sum(h))

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

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



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

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    H=[int(_) for _ in input().split()]
    H.sort(reverse=True)
    print(sum(H[k:]))

if __name__=='__main__':
    main()

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
    n,k=map(int,input().split())
    H=[int(_) for _ in input().split()]
    H.sort(reverse=True)
    print(sum(H[k:]))

if __name__=='__main__':
    main()

Solution (Python):

import sys
import numpy as np

def solve(N: int, K: int, H: "List[int]"):
    h = np.array(sorted(H))
    k = K if N>=K else N
    if k!=0:
        print(h[:-k].sum())
    else:
        print(h.sum())

    return



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):
k = min(map(int,input().split()))
H = sorted(list(map(int,input().split())))
print([sum(H),sum(H[:-k])][k != 0])

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

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

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

sum=0
for i in range(n-k):
  sum+=newh[i]

print(str(sum))

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

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

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

Solution (Python):
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, K = il()
    H = il()
    H.sort(reverse=True)
    print(sum(H)-sum(H[0:K]))


if __name__ == '__main__':
    main()

Solution (Python):

def f(n, k, h):
    if n <= k:
        print(0)
    else:
        h = sorted(h)[::-1]
        for i in range(k):
            h[i] = 0
        print(sum(h))

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

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

Solution (Python):
n,k = 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):
import heapq
ceruleans, skills = map(int, input().split())
HP = list(map(lambda x: int(x) * (-1), input().split())) 
heapq.heapify(HP)

for i in range(skills):
  heapq.heappop(HP)

  if HP == []:
    break

print(-sum(HP))

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

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

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

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

Solution (Python):
import sys
b = list(map(int,input().split()))

N = b[0]
K = b[1]

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

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

H.sort(reverse = True)

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

sum_attack = sum(H)
print(sum_attack)

Solution (Python):
"""
int(input())
map(int,input().split())
list(map(int,input().split()))

"""

n,k=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
s=0
for i in range(n-k):
    s+=A[i]

print(s)

Solution (Python):
a,b=map(int,input().split())
List=sorted(list(map(int,input().split())))
for i in range(min(b,a)):
    List.pop()
print(sum(List))

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

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

Solution (Python):

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, K = lr()
H = lr()
H.sort(reverse=True)
H = H[K:]
answer = sum(H)
print(answer)

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

Solution (Python):
p,q= input().split()
a,b =(int(p), int(q))
h = map(int, input().split())
h_list = list(h)
h_list.sort()
ans_list =[]
if a<=b:
    print(0)
else:
    for i in range(a-b):
        
        ans_list.append(h_list[i])
    print(sum(ans_list))

Solution (Python):
n , k = map(int, input().strip().split())
h = input().split()
list = []
list1 = []
count = 0
for i in h:
    b = int(i)
    list.append(b)
if k>=len(list):
    print('0')
else:
    list.sort()
    for j in range(0, len(list)-k):
        list1.append(list[j])
    sum = sum(list1)
    print(sum)

Solution (Python):
import os

def main():
	num, count = map(int, input().split())
	hp_list = list(map(int, input().split()))
	hp_list.sort(reverse=True)
	print(sum(hp_list[count:]) if count != 0 else sum(hp_list))
	
if __name__ == "__main__":
	main()

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

h.sort()

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

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

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

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

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

H_sorted = sorted(Hn,reverse=True)
H_sorted[:K]=[0]*K

print(sum(H_sorted))

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

Solution (Python):

def input1():
	return int(input())


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


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


H,K=input2()
h=input_array()

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

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

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

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

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

sum=0
if K>=N:
  print(sum)
else:
  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()))
A = sorted(H)
if len(A) <= K:
    print(0)
else:
    print(sum(A[0:len(A)-K]))

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

h_list = [int(s) for s in input().split()]
h_list.sort()
if k > 0:
    h_list = h_list[:-k]

ans = sum(h_list)
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):
from heapq import heapify, heappush, heappop
N, K = map(int, input().split())
H = list(map(int, input().split()))

H = [-h for h in H]
heapify(H)
for _ in range(K):
    if len(H) == 0:
        break
    heappop(H)

print(-sum(H))

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

count = 0
if k<n:
  num = sorted(num)
  num = num[::-1]
  for i in range(k,n):
    count = count + num[i]
  print(count)
  exit()
print(count)

Solution (Python):
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

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

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

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

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

K = int(K)
num = K-1


ATC = sum(mon[K:])
print(ATC)

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

if k >= n:
    print(0)
else:
    for _ in range(k):
        h.pop()

    h_sum = 0

    for i in h:
        h_sum += i

    print(h_sum)

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

H = sorted(H)
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()
for i in range(k):
    if len(h_list) > 0:
        h_list.pop()
print(sum(h_list))

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

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

Solution (Python):
import sys
input = sys.stdin.readline
import math
def print_ans(N, K, ar):
    """Test Case
    >>> print_ans(3, 1, [4, 1, 5])
    5
    >>> print_ans(8, 9, [7, 9, 3, 2, 3, 8, 4, 6])
    0
    >>> print_ans(3, 0, [1000000000, 1000000000, 1000000000])
    3000000000
    """
    if K >= len(ar):
        print(0)
    elif K == 0:
        print(sum(ar))
    else:
        ar = sorted(ar)
        print(sum(ar[:-K]))

if __name__ == '__main__':
    N, K = map(int, input().rstrip().split())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, K, ar)

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

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

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

count = 0
H = sorted(H,reverse=True)

count += sum(H[K:])

print(count)

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


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

Solution (Python):
N, K = map(int, input().split())
H = list(map(int, input().split()))
h = sum(H)
choniki = 0
H_sorted = sorted(H, reverse=True)

if K >= len(H):
	print(0)
else:
	for i in range (0, K):
		choniki+=H_sorted[i]
	print(h-choniki)

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

Solution (Python):
n,k = map(int, input().split())
monsters = list(map(int, input().split()))
monsters = sorted(monsters)
count = 0
if len(monsters) <= k:
    print("0")
    exit()

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


for j in monsters:
    count += j
print(count)

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

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

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

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

if K>=N:
	print(0)
	exit()    
H.sort()
for i in range(K):
	H[N-1-i]=0
    
print(sum(H))

Solution (Python):
enemy,skill=map(int,input().split())
hp=list(map(int,input().split()))
if skill>enemy:
    print(0)
else:
    hp.sort()
    for i in range(skill):
        del hp[-1]
    print(sum(hp))