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

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

Solution (Python):
import sys

sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n, k = LI()
    hs = sorted(LI(), reverse=True)
    if k >= n:
        print(0)
    else:
        print(sum(hs[k:]))

if __name__ == '__main__':
    main()

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

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

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

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

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

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

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

H.sort(reverse=True)

ans=sum(H[K:N])

print(ans)

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

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

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

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

Solution (Python):
N, K = map(int, input().split())
H = sorted([int(x) for x in 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()))
h.sort()
if n <= k:
    print(0)
else:
    d = n - k
    print(sum(h[:d]))

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

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

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

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

print(ans)

Solution (Python):

def resolve():
    N,K =(int(i) for i in input().split())
    H=[int(i) for i in input().split()]
    H.sort(reverse=True)
    if K>=N:
        print(0)
        return
    print(sum(H[K:]))






if __name__ == "__main__":
    resolve()

Solution (Python):

from itertools import permutations, combinations
from fractions import gcd
from collections import Counter
from math import sqrt
import sys
input = sys.stdin.readline
def lcm(x, y):
    return (x*y//gcd(x, y))
def small_letters():
    return [chr(i) for i in range(97, 97+26)]
def capital_letters():
    return [chr(i) for i in range(65, 65+26)]
def continual_letters(list_x):
    """example"""
    """[2,2,2,2,4,4,5,5,5,8,8,8,8,8] => [4,2,3,5]"""
    i,j = 0,0
    result = []
    k = len(list_x) - 1
    while(True):
        A = list_x[i]
        while(True):
            print(j)
            if list_x[j] != A:
                break
            if j >= k:
                break
            j += 1
        result.append(j-i)
        if i >= k:
            break
        i = j
    result[-1] += 1
    return result


def main():
    """ここに書いてね"""
    N,K = map(int,input().split())
    HPs = list(map(int,input().split()))
    HPs.sort()
    if K >= N:
        print(0)
    else:
        print(sum(HPs[:N-K]))

if __name__ == '__main__':
    main()

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

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

    H.sort()
    h = H[:N-K]
    print(sum(h))


if __name__ == "__main__":
    main()

Solution (Python):



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

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

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

si = lambda: input()
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n,k=nm()
h=nl()
h.sort(reverse=True)
ans=0
for i in range(n):
    if i<=k-1:
        continue
    ans+=h[i]
print(ans)

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

Solution (Python):
N,K = map(int,input().split())
H = list(map(int,input().split()))
H = sorted(H,reverse = True)
if K>=N:
  print(0)
else:
  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)
else:
	h.sort()
	cnt = 0
	for i in range(n-k):
		cnt += h[i]
	print(cnt)

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

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

Solution (Python):
import numpy as np

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

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

H_sort = np.sort(np.array(H))[::-1]

print(int(H_sort[K:].sum()))

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

h = sorted(h,reverse = True)
minus = 0
for i in range(min(k,n)):
    minus += h[i]
print(sum(h)-minus)

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

out=0
if b==0:
    for i in A:
        out+=i
else:
    for i in A[:-b]:
        out+=i

print(out)

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):
def main():
    n,k=map(int,input().split())
    h=sorted(list(map(int,input().split())))
    if k>=n:
        print(0)
    else:
        for i in range(k):
            _=h.pop(-1)
        print(sum(h))
    
if __name__ == '__main__':
    main()

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

count = 0

h.sort(reverse = True)

for i in range(k):
    if i > n-1:
        break
    h[i] = 0

for i in range(n):
    count += h[i]

print(count)

Solution (Python):

import sys


def solve(N: int, K: int, H: "List[int]"):
    if N <= K:
        print(0)
        return

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

h.sort()
h.reverse()

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

Solution (Python):

import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
import copy
import heapq
from collections import defaultdict
from heapq import heappop, heappush
import itertools
input = sys.stdin.readline






















def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))

def main():
	N,K = inputMap()
	H = inputList()

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

	ans = 0
	for i,vol in enumerate(H):
		if K > 0:
			K -= 1
			
			continue
		ans += vol

	print(ans)




if __name__ == "__main__":
	main()

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

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

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

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

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

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

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




new_h=h[0:max(n-k,0)]


print(sum(new_h))

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

H.sort()
K = min(K, N)
ans = sum(H[: N - K])
print(ans)

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

H.sort(reverse=True)

print(sum(H[K:]))

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

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


main()

Solution (Python):


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


lst.sort(reverse=True)

print(sum(lst[K:]))

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(-1)
print(sum(H) if len(H) > 0 else 0)

Solution (Python):
n, k = list(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(reverse=True)
ans = sum(h[k:])
print(ans)

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

Solution (Python):


def main():
    N, K = map(int, input().split())
    HN = list(map(int, input().split()))
    HN.sort()
    print(sum(HN[:-K]) if K != 0 else sum(HN))


if __name__ == '__main__':
    main()

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

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

print(ans)

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

h_list.sort(reverse=True)

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

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

Solution (Python):

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

h_list.sort()

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

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

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

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

Solution (Python):
import sys

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

n,k = get_ints()
Arr = get_array()

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

Arr.sort(reverse = True)
ans = 0
for i in range(k,n):
    ans+=Arr[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):

import sys


def solve(N: int, K: int, H: "List[int]"):
    H.sort()
    ans = 0
    for i in range(N-K):
        ans += H[i]
    print(ans)

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

Solution (Python):


N, K = map(int, input().split(' '))
H = [int(h) for h 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] = list(map(int,input().split()))
H = list(map(int,input().split()))
H.sort(reverse=True)
output = 0
for i in range(N):
    if K>0:
        output += 0
    else:
        output += H[i]
    K += -1
print(output)

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

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

A.sort()
A.reverse()
ans=sum(A)
for i in range(min(k,n)):
    ans-=A[i]
print(ans)

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

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

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

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

if k>=len(H):
       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 = [int(x) for x in input().split()]
H = sorted(H, reverse=True)
if K >= N:
    print(0)
else:
    print(sum(H[K:]))

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

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

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

Hs.sort(reverse=True)
if N > K:
    print(sum(Hs[K:]))
else:
    print(0)

Solution (Python):
n,k = [int(j) for j in input().split()]
l = [int(j) for j in input().split()]
l.sort()
l = l[::-1]
for i in range(min(k, n)):
    l[i] = 0
print(sum(l))

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

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):
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()

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

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


H = sorted(H,reverse=True)




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

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

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

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

print(ans)

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

Solution (Python):
(n, k), *D, = [list(map(int, s.split())) for s in open(0)]
D = D[0]

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

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

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

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

Solution (Python):
import math
def A():
    temp = [int(i) for i in input().split()]
    print(int(math.ceil(temp[0]/temp[1])))

def B():
    temp = [int(i) for i in input().split()]
    H = temp[0]
    N = temp[1]
    A = [int(i) for i in input().split()]
    if H <= sum(A):
        print('Yes')
    else:
        print('No')

def C():
    temp = [int(i) for i in input().split()]
    N = temp[0]
    K = temp[1]
    H = [int(i) for i in input().split()]
    if N <= K:
        print(0)
        return
    H.sort(reverse=True)
    print(sum(H[K:]))
    
C()

Solution (Python):
import sys
def I(): return int(sys.stdin.readline())
def LI(): return [int(x) for x in sys.stdin.readline().split()]

def main():
    N,K = LI()
    H = LI()

    H.sort()

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

if __name__ == "__main__":
    main()

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 fractions import gcd
from bisect import bisect
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
    n, k = MAP()
    H = LIST()
    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.sort(reverse = True) 
ans = sum(h[k:]) 
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 = sorted(map(int, input().split()), reverse=True)

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

ans = sum(H[K:])

print(ans)

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

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

if __name__ == '__main__':
    solve()

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

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

h.sort(reverse=True)
if n<=k:
  print(0)
else:
  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):
import math
import sys

m=10**9 + 7 
sys.setrecursionlimit(1000010)
(N, K) = list(map(int,input().split()))
H  = list(map(int,input().split()))
H.sort(reverse=True)


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

Hrest = H[K:]

ans = sum(Hrest)
print(ans)

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

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

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

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

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

monster = len(hps)

hps = sorted(hps, reverse=True)

for i in range(k):
    hps[i % monster] = 0

print(sum(hps))

Solution (Python):
import math
import sys

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

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

    print(ans)

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

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




get = lambda: int(raw_input().strip())
getl = lambda: raw_input().strip()
gets = lambda: map(int, raw_input().strip().split())
getss = lambda n: [gets() for _ in xrange(n)]


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

Solution (Python):
from math import factorial
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


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


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def MS(): return map(str, input().split())


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']



show_flg = True


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

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

    for h in H[K:]:
        ans += h

    print(ans)


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




def solve(inp):
    import math
    (N, K) = map(int, inp.readline().strip().split(' '))
    H = list(map(int, inp.readline().strip().split(' ')))

    if K > len(H):
        return "0"

    H = sorted(H)
    H = H[:(N - K)]

    print(sum(H))


def main():
    import sys
    result = solve(sys.stdin)
    if result is not None and result != '':
        print(result)


if __name__ == '__main__':
    main()

Solution (Python):
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
if k >= n:
    print(0)
elif k == 0:
    print(sum(h))
else:
    h.sort()
    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.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(" "))
    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.sort(reverse=True)
if k > n:
    k = n
for i in range(k):
    h[i] = 0
print(sum(h))

Solution (Python):
from bisect import *
from collections import *
from itertools import *
import functools
import sys
import math
from decimal import *
from copy import *
from heapq import *
from fractions import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10**5+10
MOD = 10**9+7
spf = [i for i in range(MAXN)]
spf[0]=spf[1] = -1
def sieve():
    for i in range(2,MAXN,2):
        spf[i] = 2
    for i in range(3,int(MAXN**0.5)+1):
        if spf[i]==i:
            for j in range(i*i,MAXN,i):
                if spf[j]==j:
                    spf[j]=i
def fib(n,m):
    if n == 0:
        return [0, 1]
    else:
        a, b = fib(n // 2)
        c = ((a%m) * ((b%m) * 2 - (a%m)))%m
        d = ((a%m) * (a%m))%m + ((b)%m * (b)%m)%m
        if n % 2 == 0:
            return [c, d]
        else:
            return [d, c + d]

def charIN(x= ' '):
    return(sys.stdin.readline().strip().split(x))

def arrIN(x = ' '):
    return list(map(int,sys.stdin.readline().strip().split(x)))

def ncr(n,r):
    num=den=1
    for i in range(r):
        num = (num*(n-i))%MOD
        den = (den*(i+1))%MOD

    return (num*(pow(den,MOD-2,MOD)))%MOD

def flush():
    return sys.stdout.flush()

'''*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*'''
n,k = arrIN()
a = arrIN()
if k>=n:
    print(0)
else:
    a.sort()
    for i in range(k):
        a.pop()
    print(sum(a))

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

Solution (Python):
from operator import itemgetter
from math import log10,ceil

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


if __name__ == "__main__":
    main()

Solution (Python):

import sys
input = sys.stdin.buffer.readline


from collections import defaultdict

con = 10 ** 9 + 7

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


def main():
	N, K = getlist()
	H = getlist()
	H = sorted(H)
	ans = 0
	if K >= N:
		print(0)
		return
	
	for i in range(N - K):
		ans += H[i]

	print(ans)

if __name__ == '__main__':
	main()

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):
import sys
from collections import defaultdict
from collections import deque
import numpy as np
import heapq
from heapq import heappush, heappop


sys.setrecursionlimit(10 ** 7)

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

H.sort(reverse=True)

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

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

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

h = sorted(h,reverse=True)

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

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

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

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

Solution (Python):

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

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

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

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

def one_int():
    return int(input())

def one_str():
    return input()

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

N,K = two_int()
H=many_int()

sH=sorted(H)

newK = max(N-K,0)

min_sH = sH[:newK]

print(sum(min_sH))

Solution (Python):
import math

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

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

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

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

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

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

for i in range(K):
    if i>=N:
        break
    H[i]=0

print(sum(H))

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

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

    print(sum(h))

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

Hlist.sort(reverse=True)

if K < N:
    print(sum(Hlist[K:]))
else:
    print(0)

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


if __name__ == "__main__":
    main()

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

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

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