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 = input().split()
N = int(N)
K = int(K)
H = input().split()
H = [int(h) for h in H]
H.sort(reverse = True)

I = K if K <= N else N
for i in range(0, I):
    H[i] = 0

print(sum(H))

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

print(sum)

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

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

for i in range(len(m)):
  a=a+m[i]
  
print(a)

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

Solution (Python):
import sys

sys.setrecursionlimit(10**9)

h, k = map(int, input().split())
hi = list(map(int, input().split()))
hi.sort(reverse=True)
del hi[:k]

num = 0
if hi == []:
    print(0)
else:
    for i in hi:
        num += i
    print(num)

Solution (Python):
n,m=map(int,input().split())
l=list(map(int,input().split()))
if m<n:
  l.sort()
  for i in range(m):
    l.pop(len(l)-1)
  print(sum(l))
else:
  print(0)

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

h = list(map(int,input().split()))
h.sort()
s=0
t=0

if k == 0:
  for i in h:
    s += i
  print(s)
elif k >= n:
  print(0)

  
else:
  k= k*(-1)
  h = h[:k]
  for j in h:
    t += j
  print(t)

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

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

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

hh.sort()

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

Solution (Python):


import sys
input=sys.stdin.readline

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

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

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

Solution (Python):
a = input()
l = a.split()
n = int(l[0])
k = int(l[1])
b = input()
ll = b.split()
for i in range(0,n):
    ll[i] = int(ll[i])
if n<k+1:
    print(0)
else:
    p = 0
    ll.sort()
    for i in range(0,n-k):
        p = p + ll[i]
    print(p)

Solution (Python):
import heapq

enemy_list = [int(i) for i in input().split()]
hp_list = [int(i) for i in input().split()]

if enemy_list[0] == enemy_list[1]:
    print(0)
elif enemy_list[1] == 0:
    print(sum(hp_list))
else:
    print(sum(heapq.nsmallest((len(hp_list) - enemy_list[1]), hp_list)))

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

if N <= K:
    res = 0
else:
    n_num = [int(n_str) for n_str in x]
    n_num_sorted = sorted(n_num, reverse=True)
    res = sum(n_num_sorted[K:])

print(res)

Solution (Python):
import heapq

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

print(sum(H)-sum(heapq.nlargest(K, H)))

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

Solution (Python):
n,k = (int(x) for x in input().split())
h=list(int(x) for x in input().split())
h = sorted(h,reverse=True)
if n<k:
    print("0")
elif k == 0:
    print(sum(h))
else:
    n = h[k:]
    print(sum(n))

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

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

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

Solution (Python):
inp = raw_input().split()
N = int(inp[0])
K = int(inp[1])
H = raw_input().split()
H = list(map(int, H))

def must_attack():
	H.sort()
	for i in range(K):
		if len(H) > 0:
			H.pop()
	sum_damage = 0
	for i in H:
		sum_damage += i
	return sum_damage

ans = must_attack()
print(ans)

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

cnt = 0

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

  cnt += sum(H)

  print(cnt)

Solution (Python):
nk = [int(i) for i in input().split()]
sum = 0

list = [int(i) for i in input().split()]
list.sort(reverse=True)

for i in range(nk[1], nk[0]):
  sum += list[i]

print(sum)

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

Solution (Python):
x,y = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
for i in range(y):
    if N:
        N.pop()
print(sum(N))

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

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

if len(HH) == 0:
    print(0)
else:
    print(sum(HH))

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

H.sort(reverse=True)

sum = 0
for n in range(K,N):
  sum = sum + H[n]
  
print(sum)

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

if N > K :

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

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

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

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

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

Solution (Python):
s = []
for i in range(2):
    s.append(input().split())
n = int(s[0][0])
k = int(s[0][1])
answer = 0
hs = s[1]
h = [int(a) for a in hs]
h.sort()
h.reverse()
if(k<n):
    for i in range(k,n):
        answer = answer + h[i]
print(answer)

Solution (Python):
a,b = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
for i in range(b):
    if N:
        N.pop()
print(sum(N))

Solution (Python):
a = input().split(" ")
bl = input().split(" ")
b = []
for num in bl:
  b.append(int(num))
b.sort(reverse = True)
N = int(a[0])
K = int(a[1])

m=0
i=0
if len(b) <= K:
  print(0)
else:
  for h in range(K,len(b)):
    i = i + b[h]
  print(i)

Solution (Python):













    


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

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

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

if K>=N:
  print("0")
else:
  H_min=sorted(H)[:c]
  ans=sum(H_min)
  print(ans)

Solution (Python):

import heapq
n,k = [int(x) for x in input().split()]
h = sorted([int(x) for x in input().split()])

s = 0
if k >= n:
    print(0)
else:
    h = h[:n-k]
    for j in h:
        s += j
    print(s)

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

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

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

Solution (Python):

n,k=(int(x) for x in input().split())


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

hi=sorted(h,reverse=True)

cnt=0



if k >= len(hi):
    i = len(hi)
else:
    i = k


while (i<len(hi)):
    cnt += hi[i]
    i += 1

print(cnt)

Solution (Python):
import sys

def main():
    k = int(input().replace('\n','').split()[1])
    tmp = list(map(int,input().replace('\n','').split()))
    tmp.sort(reverse=True)
    n=0
    for i in tmp[k:]:
        n+=int(i)
    print(n)
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

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

Solution (Python):
buf = input().split(" ")
N=int(buf[0])
K=int(buf[1])
 
H = list(map(int, input().split())) 
 
H=sorted(H)

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

if len(H) != 0:
  print(sum(H))
else:
  print(0)

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

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

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

h.sort(reverse=True)


count = 0
for v in h[k:]:
    count += v
print(count)

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

print(sum(N[K:]))

Solution (Python):
inp = input().rstrip().split(" ")
N = int(inp[0])
K = int(inp[1])
inp = input().rstrip().split(" ")
HP = [0 for i in range(N)]
for i in range(N):
  HP[i] = int(inp[i])
HP.sort()
HP.reverse()
ans = 0
for i in range(N):
  if i >= K:
    ans += HP[i]
print(ans)

Solution (Python):
N, K = map(int, input().split())
Hs = list(map(int, input().split()))
Hs.sort(reverse=True)
if K > N:
  print(0)
else:
  for i in range(K):
    Hs[i] = 0
  print(sum(Hs))

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

if(K >= len(H)):
    print(0)
else:
    for i in range(i, len(H)):
        sum += H[i];
    print(sum)

Solution (Python):
X = list(map(int, input().split()))
Y = list(map(int, input().split()))

N = X[0]
K = X[1]

S = sorted(Y, reverse=True)

S[:K] = []

print(sum(S))

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

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

Solution (Python):
N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))
A = sorted(H)
i=0
a=N-K
if K >= N:
    print('0')

else:
    B=A[:a]
    C=sum(B)
    print(C)

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

Solution (Python):

N,K = map(int,input().split())
H = list(map(int,input().split()))
ans = 0
for i , val in enumerate(sorted(H,reverse = True)):
    if i+1 > K:
        ans += val
print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
N,K = input().split()
N = int(N)
K = int(K)

H = input().split()
H = [int(s) for s in H]
H.sort(reverse=True)

if N < K:
  print(0)
else:
  for i in range(0,K):
    H[i] = 0

  sumdata = 0
  for i in range(0,len(H)):
    sumdata += H[i]
  print(sumdata)

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

HP = sum(H)
ld = sorted(H , reverse=True)
if K >= len(H):
    print(0)

else:
    Z = sum(ld[:K])
    hp = HP - Z
    print(hp)

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

list.sort(A, reverse=True)
if K<=N:
    for i in range(K):
        A[i]=0
elif K>=N:
    for i in range(N):
        A[i]=0
print(sum(A))

Solution (Python):
NK = input().split()
N = int(NK[0])
K = int(NK[1])
H = input().split()
H_int = []

for i in range(N):
  H_int.append(int(H[i]))

H_int_sorted = sorted(H_int)

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

Solution (Python):
s = input().split()
N = int(s[0])
K = int(s[1])

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

print(sum(H_s[K:]))

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

H.sort(reverse=True)


count = 0

if(K<N):
  for i in range(K,N):
    count+=H[i]
    

print(count)

Solution (Python):


import heapq

def c():
    
    n, k = map(int, input().split())
    if k >= n:
        return 0

    healths = list(map(int, input().split()))
    heapq.heapify(healths)

    res = 0
    for _ in range(n - k):
        res += heapq.heappop(healths)

    return res


def main():
    res = c()
    print(res)

    

main()

Solution (Python):
import numpy as np
N, M = map(int, input().split())


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

count=0
if N>=M:
    for i in range(N-M):
        count+=A[i]
    print(count)



else:
    print(0)

Solution (Python):
from heapq import heapify, heappop
from math import ceil
N, K = map(int, input().split())
H = list(map(int, input().split()))




Hminus = list(map(lambda x: x*(-1), H))

heapify(Hminus)

if K > len(H):
    print(0)
else:
    for _ in range(K):
        heappop(Hminus)
    print(sum(Hminus)*(-1))

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

a.sort()
attack = 0

for i in range(c[0]-c[1]):
  attack += a[i]

print(attack)

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

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

Solution (Python):

import numpy as np
N, K = map(int, input().split())
H = np.array(list(map(int, input().split())), dtype='int64')
H.sort()

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

print(subset.sum())

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

Solution (Python):
N,K = list(map(int, input().split(" ")))
H = sorted(list(map(int, input().split(" "))), reverse=True)
Z = 0
R = 0
for n,e in enumerate(H):
  if (n == K):
    Z = n
    break
  elif (K >= len(H)):
    Z = len(H)
    break
for i in H[Z:]:
  R += i
print(R)

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

h.sort(reverse = True)

if k <= len(h):
    h[0: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)
c=len(H)
if c<=K:
    count=0
else:
    H2=H[K:]
    count=sum(H2)
print(count)

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

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
a,b = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
for i in range(b):
    if N:
        N.pop()
print(sum(N))

Solution (Python):
N, K = map(int, input().split())
H = [int(x) for x in 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()))

ans = 0

if k >= n:
  ans = 0
else:
  h_sort = sorted(h, reverse=True)
  for i in range(k, len(h_sort)):
    ans += h_sort[i]

print(ans)

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

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

MONS.sort()

if K == 0:
    print(sum(MONS))
else:
    if len(MONS) <= K:
        print(0)
    else:
        for _ in range(K):
            MONS.pop(-1)
        print(sum(MONS))

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

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

Solution (Python):
import numpy as np

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

if K < len(H):
    print(np.sum(H[K:]))
else:
    print(0)

Solution (Python):
import sys

sys.setrecursionlimit(1000000000)

def dfs(i, special):
    if (i > N - 1):
        return 0
    if (special > 0):
        return dfs(i + 1, special - 1)
    else:
        return  MONSTERS[i] + dfs(i + 1, special)       

N, K = map(int, input().split())
MONSTERS = map(int, input().split())
MONSTERS = list(reversed(sorted(MONSTERS)))
print(dfs(0, K))

Solution (Python):
a,b = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
for i in range(b):
    if N:
        N.pop()
print(sum(N))

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

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

b.sort(reverse=True)
ans = 0

del b[:k]
n -= k

if n < 0:
    print('0')
else:
    print(sum(b))

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

d.sort()
d.reverse()
del d[0:k]

print(sum(d))

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

Solution (Python):
a,b=map(int,input().split())
c=[int(x) for x in input().split()]
d=sorted(c)
for i in range(b):
    del d[-1]
    if d==[]:
        break
print(sum(d))

Solution (Python):
kazu, hissatu = map(int,input().split())
hairetu = list(map(int,input().split()))

toru = kazu-hissatu

if toru<=0:
  print(0)
else:
  hairetu.sort()
  print(sum(hairetu[:(kazu)-hissatu]))

Solution (Python):
i = list(map(int, input().split()))
j= list(map(int, input().split()))
x=sorted(j, reverse=True)
z=0
 
if i[1]>=len(j):
  print(0)
else:
  for a in range(i[1],len(x)):
    z+=x[a]
  print(z)

Solution (Python):
n_ene, n_special = map(int, input().split())
hps = list(map(int, input().split()))

if n_special >= n_ene:
    print(0)
else:
    hps.sort(reverse=True)
    hps = hps[n_special:]
    print(sum(hps))

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

count = 0

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


    
    count = sum(H_list)
    print(count)

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


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

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

Solution (Python):
N,M = map(int,input().split())
A =list(map(int,input().split()))
new_list = sorted(A, reverse=True)
ans = 0

del new_list[0:M]
        
if not new_list:
    print(ans)
else:
    ans +=sum(new_list)
    print(ans)

Solution (Python):
a = list(map(int,input().split()))
N = a[0]
K = a[1]
H = list(map(int,input().split()))
H.sort(reverse=True)
ans = 0
MOD = 10**9 + 7
if K >= N:
    print(0)
else:
    for i in range(K,N):
        ans += H[i]

    print(ans)

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

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

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

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

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

ans = -1



if n<=k:
  ans = 0
elif n>k:
  ans = sum(h[0:n-k])

print(ans)

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

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

Solution (Python):

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


h_list.sort(reverse = True)

temp_k = k
sum_normal_attack = 0

while temp_k < n:
    sum_normal_attack = sum_normal_attack + h_list[temp_k]
    temp_k = temp_k + 1

print(sum_normal_attack)

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


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

Solution (Python):
import numpy as np
H, K = map(int, input().split())
H = np.array([int(num) for num in input().split()])
H_sort = np.sort(H)[::-1]
print(int(H_sort[K:].sum()))

Solution (Python):




import sys
input = sys.stdin.readline



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

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

    print(res)



main()

Solution (Python):
attack=list(map(int,input().split()))
damage=list(map(int,input().split()))
A=0

N=attack[0]
K=attack[1]
damage.sort(reverse=True)

if N>K:
  del damage[:K]
  print(sum(damage))

else:
  print(0)

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

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



h.sort()

for i in range(k):
  if h != []:
    h.pop()

print(sum(h))

Solution (Python):
n, k = (int(x) for x in input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
if k != 0:
    H.sort(reverse=True)
    del H[:k]
print(sum(H))

Solution (Python):
i=list(map(int,input().split()))
j=list(map(int,input().split()))
c=0
cnt=1
n=i[1]
j.sort(reverse=True)
for x in j:
  if cnt>n:
    c+=x
  else:
    cnt+=1
print(str(c))

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

H.sort()
H.reverse()
del H[:k]
a=sum(H)
print(a)

Solution (Python):
num = input().split(" ")
monster = int(num[0])
atk = int(num[1])
hpoints = list(input().split(" "))
hpoints_i = [int(i) for i in hpoints]

hpoints_i.sort(reverse=True)

result = sum(hpoints_i[atk:])
print(result)

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

Solution (Python):
a,b = map(int,input().split())
N = list(map(int,input().split()))
N.sort()
for i in range(b):
    if N:
        N.pop()
print(sum(N))

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

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

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

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().rstrip().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = 0

for i, x in enumerate(a):
    if i >= K:
        ans += x
        
print(ans)

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

count = 0

if N < K:
    K = N

for i in range(K):
    H_list.pop(-1)

count += sum(H_list)

print(str(count))

Solution (Python):
x = input().split()
n = int(x[0])
k = n if n < int(x[1]) else int(x[1])

h = input().split()
h = [int(i) for i in h]
h.sort(reverse=True)

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

print(sum(h))

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

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

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

h.sort()

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

Solution (Python):
def main():
    N, K = map(int, input().split())
    H = sorted(list(map(int, input().split())), reverse=True)
    all = sum(H)
    at = 0
    if (K > N):
        K = N
    for i in range(K):
        at += H[i]
    result = all - at
    if result <= 0:
        result = 0
    print(result)

if __name__ == '__main__':
    main()

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):
a,b= map(int, input().split())
S=list(map(int, input().split()))
import numpy as np
SS=np.sort(S)
Sum=0
for i in range(a-b):
    Sum=Sum+SS[i]
print(Sum)

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

H_sorted = sorted(H, reverse=True)

print(sum(H_sorted[K:]))

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

Solution (Python):
def main():
    n, k = [int(x) for x in input().split()]
    h = [int(x) for x in input().split()]
    nk = n-k
    if nk < 0:
        nk = 0
    at = sorted(h)[:nk]
    print(sum(at))

if __name__ == '__main__':
    main()

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

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

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


if N<K:
	K=N

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



print(sum(H))

Solution (Python):
s = input().split()
n, k = int(s[0]), int(s[1])
 
ss = input().split()
l = [int(i) for i in ss]
 
l.sort()
if n < k:
  print(0)
elif k == 0:
  print(sum(l))
else:
  print(sum(l[:n-k]))

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

arr = sorted(arr,reverse=True)
arr[:min(n,k)] = [0]*min(n,k)

print(sum(arr))

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

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

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

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

if N<=K:
    print(ans)
else:
    for i in range(1,K+1):
        f=-1*i
        ar[f]=0

    for i in range(N):
        ans+=ar[i]

    print(ans)

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

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

Solution (Python):
n,k=map(int, input().split())
l=list(map(int, input().split()))
if k>=n:
    print("0")
    exit(0)

l.sort()

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

print(sum)

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

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

h.sort(reverse=True)

min = 0

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

if len(h) <= k:
    print(0)
else:
    sorted_h = sorted(h, reverse=True)
    print(sum(sorted_h[k:]))

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

list.sort()

i=0
m=0
r=0

while(i<n-k):
  m+=list[i]
  i+=1

print(m)

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

if K == 0:
    print(sum(List))
    exit()

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

List.sort(reverse=True)
del List[:K]

print(sum(List))

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

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

h.sort()

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


if A > 0:
  print(A)
else:
  print(0)

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

H.sort()

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

Solution (Python):
dummy = list(map(int, input().split(" ")))
N = dummy[0]
K = dummy[1]

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

H.sort(reverse = True)

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

print(sum(H))

Solution (Python):


n, k = map(int, input().split())
hlist = list(map(int, input().split()))
nlist = sorted(hlist, reverse=True)
del nlist[0:k]
total = sum(nlist)
print(total)

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

H = sorted(H)[::-1]

cnt = 0
for i in range(N):
    if K > 0:
        K -= 1
    else:
        cnt += H[i]

print(cnt)

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

sum = 0

H = []
tmp = input().split()
for i in range(N):
	H.append(int(tmp[i]))

  
H.sort() 
for i in range(K):
  try:
    H.pop()
  except IndexError:  
    pass

sum = 0  
  
for i in H:
  sum += i

print(sum)

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