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-----
3 1
4 1 5

-----Sample Output-----
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.

Difficulty: introductory

Starter code:

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

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


n, k = map(int, input().split())
h = [int(s) for s in input().split()]

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

import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 6)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

n, k=I()
h = l()
h.sort(reverse=True)

print(sum(h[k:]))

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


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

H.sort(reverse=True)

if K<=len(H):
  print(sum(H[K:len(H)+1]))
else:
  print(0)

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

a = 0

if K > N:
  a = K - N

for _ in range(a):
  H.append(0)

H.sort(reverse = True)
sum = 0

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


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

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

# モンスターの数より使える必殺技の数が多ければおわり
if n <= k:
    print((0))
    return

num = 0
# 降順にソート
h.sort(reverse=True)
# 大きい数順に必殺技を使う
# 残ったやつを数える
for i in h[k:]:
    num += i

print(num)


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

print((sum(H)))


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

health, attacks = map(int, input().split())
num_list = [num for num in map(int, input().split())]
num_list.sort(reverse=True)

print(sum(num_list[attacks:]))

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

lst = [ int(i) for i in input().split() ]
if len(lst) <= k:
  print(0)
  return
lst = sorted(lst)
for i in range(k):
  lst.pop()
print(sum(lst))

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

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

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

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

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

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

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


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

num, deathblow = map(int, input().split())
enemy_table = list(map(int, input().split()))
list.sort(enemy_table, reverse=True)
sum = 0
if num <= deathblow:
    print(0)
else:
    for i in range(deathblow):
        enemy_table[i] = 0
    for j in range(num):
        sum += enemy_table[j]
    print(sum)

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


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

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

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

n, k = map(int, input().split())
h = list(sorted(map(int, input().split())))
x = 0
if n > k:
    for i in range(n - k):
        x += h[i]

print(x)

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

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

N,K=map(int,input().split())
H=sorted(map(int,input().split()))
if K==0:
    print(sum(H))
elif N<K:
    K=N
    del H[-K:]
    print(sum(H))
else:
    del H[-K:]
    print(sum(H))

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)

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)

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

print(ans)

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

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

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

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

enemy.sort(reverse=True)

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

else:
  

  for x in range(k):
    enemy[x] = 0
  
  print((sum(enemy)))


def main():
	n, k = list(map(int, input().split()))
	h = [int(v) for v in input().split()]
	if k >= len(h):
		return 0
	monsters = sorted(h)
	monsters.reverse()
	return sum(monsters[k:])

def __starting_point():
    print((main()))

__starting_point()

a,b=map(int,input().split())
n = list(map(int,input().split()))
m = sorted(n)[::-1]
if a <= b:
  print("0")
else:
  print(sum(m[b::]))

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

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

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

  print(ans)

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


def main():
    n, k = map(int, input().split(" "))
    h = list(map(int, input().split(" ")))
    h.sort(reverse = True)
    print(sum(h[k:]))
    

def __starting_point():
    main()
__starting_point()

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)

import sys
import heapq

n, k = list(map(int, input().split()))
h = []
heapq.heapify(h)
for x in map(int, input().split()):
  heapq.heappush(h, x)

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

ans = 0
for x in range(n - k):
  ans += heapq.heappop(h)

print(ans)


H, K = [int(n) for n in input().split()]
H = [int(n) for n in input().split()]

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

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

h = sorted(h,reverse=True)

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

print(ans)

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

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

print(sum(h[k:]))

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

list.sort(h,reverse=True)

if k>=n:
    print('0')
    return

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

print(c)


# C - Fennec vs Monster

n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
h.sort(reverse=True)
if k >= n:
    k = n
h2 = h[k:]

print((sum(h2)))


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

print(sum(h[k:]))

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

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

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

#!/usr/bin/env python3
import sys
from itertools import chain


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


def main():
    tokens = chain(*(line.split() for line in sys.stdin))
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    H = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    answer = solve(N, K, H)
    print(answer)


def __starting_point():
    main()

__starting_point()

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


h,k = list(map(int,input().split()))
lst = list(map(int,input().split()))
lst.sort()
if len(lst) >= k + 1:
  print((sum(lst[:len(lst)-k])))
else:
  print((0))



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

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

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

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

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

print(sum(H[K:]))

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

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

def ans153(N:int, K:int, H:str):
    if K==0:
        H_list=sorted(list(map(int,H.split())))
        return sum(H_list)
    elif len(list(map(int,H.split())))>K:
        H_list=sorted(list(map(int,H.split())))
        H_list=H_list[:-K]
        return sum(H_list)
    else:
        return 0

print(ans153(N,K,H))

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


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

if N <= K:
    print(0)

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

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

h.sort(reverse=True)

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

n, k = map(int, input().split())
h = sorted(list(map(int,input().split())))
if k >= len(h):
    print(0)
    return
print(sum(h[0:n-k]))

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


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


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

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

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

a = list(map(int,input().split()))
b = list(map(int,input().split()))

if len(b) <= a[1]:
    print("0")
elif a[1]==0:
    print(sum(b))
else:
    b.sort(reverse=True)
    print(sum(b[a[1]:]))

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

HP.sort()

if K>0:
    HP=HP[:-K]

print(sum(HP))

n,k = [int(x) for x in 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)

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

if k >= n:
	print(0)
else:
	# for i in range(k):
	# 	h.remove(max(h))
	h = h[:n - k]
	print(sum(h))

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

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

H.sort()
m = min(N, K)
H = H[:N-m]
ans = 0
for i in range(len(H)):
  ans += H[i]
print(ans)

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

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

h.sort(reverse = True)

print(sum(h[k:]))

#!/usr/bin/env python3
def main():
    N, K = list(map(int, input().split()))
    H = sorted([int(x) for x in input().split()])

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


def __starting_point():
    main()

__starting_point()

N, K = map(int, input().split())
H = list(map(int, input().split()))
 
# N<=Kの場合、全てのモンスターを必殺技で倒して終了
# N>Kの場合、N体のモンスターのうち、体力が高い順に、K体を必殺技で倒す
# 残ったモンスターは、攻撃によって倒す
# 攻撃の回数を求める（必殺技は数えない）ことに注意する

# 計算量はO(NlogN)で間に合う
H = sorted(H, reverse=True)
ans = 0
if N > K: ans = sum(H[K:])
  
print(ans)

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

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

def N():
    return int(input())
def L():
    return list(map(int,input().split()))
def NL(n):
    return [list(map(int,input().split())) for i in range(n)]
mod = pow(10,9)+7

#import numpy as np
import sys
import math
import collections

n,k = L()
h = L()
h.sort()
print(sum(h[:max(n-k,0)]))

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

if N <= K:
    print(0)
elif K == 0:
    print(sum(H))
else:
    total = 0
    for i in H:
        total += i
    max_hp = sum(sorted(H, reverse=True)[:K])
    print(total - max_hp)

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

Hlist = sorted(Hlist,reverse = True)
#print (Hlist)

if len(Hlist)>=K and K!=0:
  del Hlist[0:K]
elif len(Hlist)<K:
  del Hlist[0:len(Hlist)]

if len(Hlist)>0:
  print((sum(Hlist)))
else:
  print((len(Hlist)))


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

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

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)

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)


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

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

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


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

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

h.sort(reverse=True)
print(sum(h[min(n,k):]))

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

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

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


# -*- coding: utf-8 -*-
"""
Created on Tue Sep  8 01:07:55 2020

@author: liang
"""

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

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

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

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

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

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


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

n,k = map(int,input().split())
health = list(map(int,input().split()))
s_health = sorted(health)
if n <= k:
    print(0)
    return

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

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