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

import sys

def solve(N: int, K: int, H: "List[int]"):
    sum_HP = sum(H)
    H = sorted(H, reverse=True)
    if K >= N:
        print('0')
        return
    for k in range(K):
        kth_HP = H[k]
        sum_HP -= kth_HP
    if sum_HP <= 0:
        print('0')
    else:
        print(sum_HP)
    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()))

S = sorted(H, reverse=True)

print(sum(S[K:]))

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

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

a.sort(reverse =True)

print(sum(a[k:]))

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

h.sort()
ans = 0

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

print(ans)

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

print(ans)

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

h = sorted(h)
ans = 0

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

print(ans)

Solution (Python):
import heapq

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

H = list(map(lambda x:x*(-1), H))
heapq.heapify(H)

if N > K:
    for _ in range(K):
        heapq.heappop(H)

    ans = sum(H) * (-1)
else:
    ans = 0

print(ans)

Solution (Python):
N,K=map(int, input().split())
H=list(map(int,input().split()))
flag=True
if K>=len(H):
    print(0)
    flag=False

if flag:
    H.sort()
    ans=sum(H[i] for i in range(len(H)-K))
    print(ans)

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

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

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

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

h.sort(reverse=True)
del h[0 : min(n, k)]

print(sum(h))

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

print(sum(h[k:]))

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

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)

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

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

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

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

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

H.sort(reverse = True)

print(sum(H[K : ]))

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

H.sort(reverse=True)

ans = sum(H[K:])

print(ans)

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

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

l = sorted(h)
if k >= n:
  print('0')
else:
  for _ in range(k):
    l.pop(-1)
  print(sum(l))

Solution (Python):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
nokori=max((n-k),0)
if nokori==0:
  print(0)
  exit()

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

Solution (Python):


def solve(N, K, Hs):
    Hs.sort(reverse=True)
    ans = 0
    for h in Hs:
        if K > 0:
            K -= 1
        else:
            ans += h
    print(ans)


if __name__ == '__main__':
    N, K = map(int, input().split())
    Hs = [int(i) for i in input().split()]
    solve(N, K, Hs)

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

if len(H)<=K:
    print(0)
else:
    H.sort()
    cnt=0
    for i in range(len(H)-K):
        cnt+=H[i]
    print(cnt)

Solution (Python):


def main():
    N, K = map(int, input().split())
    if N <= K:
        print('0')
        exit()
    else:
        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()
for k in range(K):
    if H:
        H.pop(len(H)-1)
H = sum(H)
print(H)

Solution (Python):
H,N = list(map(int,input().split(" ")))
A = list(map(int,input().split(" ")))
total = 0
A.sort(reverse=True)
del A[:N]
for i in A:
  total +=i
print(total)

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

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

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

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

print(sum(LIST[k:]))

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

h.sort(reverse=True)

h = h[k:]

print(sum(h))

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

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

Solution (Python):
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())





def main():
    n, k = geta(int)
    h = list(geta(int))

    h.sort()

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


if __name__ == "__main__":
    main()

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


if len(H) <= K:
    print('0')
else:
    HA = sorted(H)
    HA = HA[:len(H) - K]
    print(str(sum(HA)))

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

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

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

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

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

Solution (Python):

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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


if __name__ == '__main__':
    main()

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

if K < length:
    ans = sum(H[:length - K])
else:
    ans = 0

print(ans)

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):
def main():
    N,K = map(int, input().split())
    H = list(map(int, input().split()))
    H = sorted(H, reverse=True)
    ans = sum(H[K:])
    print(ans)

main()

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

    hs = sorted(hs)[::-1]
    ans = sum(hs[k:])
    print(ans)


if __name__ == "__main__":
    main()

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

main()

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




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

Solution (Python):

import sys
input = lambda: sys.stdin.readline().strip()

def solve(N: int, K: int, H: "List[int]"):
    H.sort()
    print(sum(H[i] for i in range(N - K)) if K < N else 0)

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

def solve():
    global n, k, h
    if n <= k:
        return 0
    s = sum(h)
    h = sorted(h, reverse=True)
    for i in range(k):
        s -= h[i]
    return s

print(solve())

Solution (Python):
import math
import string
import collections
from collections import Counter


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n, k = map(int, input().split())
h = readints()
h_sort = sorted(h, reverse=True)


h_sort2 = h_sort[k:]
if h_sort2 == []:
    print(0)
    exit()
ans = 0
for i in range(len(h_sort2)):
    ans += h_sort2[i]
print(ans)

Solution (Python):

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

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

Solution (Python):
H, 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()))
J = sorted(H)
if N <= K:
    print(0)
    exit()
P = J[:(N-K)]
print(sum(P))

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

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

sort = sorted(H, reverse = True)
ans = 0
for i in range(N):
    if i+1 > K:
        ans += sort[i]
    
print(ans)

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

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

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

print(sum(H)-Q)

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

B=sorted(A,reverse=True)

C=sum(B[K:])
print(C)

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

Solution (Python):

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



if __name__ == '__main__':
    main()

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

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

Solution (Python):
import sys
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort()
for _ in range(K):
    H.pop(-1)
    if len(H)==0:
        print(0)
        sys.exit()
print(sum(H))

Solution (Python):
















def main():

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

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

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


if __name__ == '__main__':
    main()

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

H = list(input().split())
H = sorted([int(H[i]) for i in range(N)], reverse=True)

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

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

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

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

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

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

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

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

asum=0

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

	print(asum)

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

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

print(sum(H[K:]))

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

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

Solution (Python):
n, k = [int(s) for s in input().split()]
h_list = sorted([int(s) for s in input().split()])
for _ in range(min(n, k)):
    h_list.pop()
print(sum(h_list))

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

h=[int(_) for _ in input().split()]

h.sort()

for i in range(min(k,n)):
  h[-i-1]=0
  
print(sum(h))

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

print(sum(a))

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

print(sum(a))

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

a = R[0 : m]
point = sum(a) 
if K >= N :
    point = 0
print(point)

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=map(int,input().split())
H=list(map(int,input().split()))
if N>K:
  H.sort()
  del H[N-K:]
  print(sum(H))
else:
  print(0)

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

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

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

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, raw_input().split(' '))
monsters = map(int, raw_input().split(' '))
monsters.sort()

print sum(monsters[:max(0,n-k)] or [0])

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

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

n,k=nm()
h = nl()

sh = sorted(h)[::-1]

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

print(sum(sh[k:]))

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

Solution (Python):
N,K=map(int,input().split())
H=[int(x) for x in input().split()]
H=sorted(H)
ans=0
if N<=K:
    print(0)
    exit()
else:
    for i in range(N-K):
        ans+=H[i]
print(ans)

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

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

sorted_H_list = sorted(H_list, reverse=True)
target_H_list = sorted_H_list[K:]
answer = sum(target_H_list)

print(answer)

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

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

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

print(sum)

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

n,k = mi()
h = li()

h.sort()

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

Solution (Python):
import sys
import math
from collections import deque
from collections import defaultdict

def main():
    n, k = list(map(int,sys.stdin.readline().split()))
    h = list(map(int,sys.stdin.readline().split()))
    h.sort(reverse=True)
    if k > len(h):
        print("0")
        return 0
    else: print(sum(h[k:]))
    return 0

if __name__ == "__main__":
    main()

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

print(sum(H2[K:]))

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

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

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 = list(map(int,input().split()))
H = list(sorted(list(map(int,input().split())),key=lambda x: -x))
print(sum(H[K:]))

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

def calCount(h):
    if K > N:
        return 0
    return sum(h[K:])

H.sort(reverse=True)
print(calCount(H))

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):
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):
import math 
import sys 

t=1
for _ in range(t):
    n,m=map(int,input().split())
    l=list(map(int,input().split()))
    l.sort()
    x=0
    for i in range(n-m):
        x+=l[i]
    print(x)

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:
  for i in range(0,k):
    h[i]=0
  print(sum(h))

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

h.sort(reverse = True)

print(sum(h[k:]))

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

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

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

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

Solution (Python):
import sys
from io import StringIO
import unittest


def resolve():
    N, K = [int(i) for i in input().split()]
    H = sorted([int(i) for i in input().split()])
    if N <= K:
        H = [0]
    else:
        
        for i in range(K):
            H[len(H) - 1 - i] = 0
        
        
        
        
        
    print(sum(H))


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

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

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

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


if __name__ == "__main__":
    
    resolve()

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

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

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

if len(H) >= K:
    H = sorted(H, reverse=True)
    del H[0:K]
else:
    H.clear()

print(sum(H))

Solution (Python):
import sys
n,k = map(int,input().split())
l = list(map(int,input().split()))
if n <= k:
    print("0")
    sys.exit()
l = sorted(l,reverse = True)
hissatu = 0
for i in range(k):
    hissatu += l[i]
total = 0
for j in l:
    total += j
print(total-hissatu)

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):
import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    assert N == len(H)
    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 = 0
for h in H[K:]:
  ans += h
print(ans)

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

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

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

if k < n:
    for i in range(k,len(h)):
        sum += h[i]
else:
    result = False

if result:
    print(sum)
else:
    print(0)

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

h.sort(reverse=True)

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

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

if n <= k:
  arr = []
elif 0 < k < n:
  arr = arr[:n-k]
print(sum(arr))

Solution (Python):

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

h_sort=sorted(h)


if n>=k:print(sum(h_sort[: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())
List=list(map(int,input().split()))
S=sorted(List)[::-1]

del S[0:K]
print(sum(S))

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

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

print(sum(H[K:]))

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n,k=map(int, input().split())
    l=list(map(int,input().split()))
    l.sort(reverse=True)
    if k>=n:
        ans=0
    else:
        ans=sum(l[k:])
    print(ans)

resolve()

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

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

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

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

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

h.sort(reverse=True)
for i in range(0,min(k,len(h))):
    h[i] = 0
hp = 0
for j in range(k,n):
    hp += h[j]

print(hp)

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

Solution (Python):
n, k = [int(_) for _ in input().split()]
h = sorted([int(_) for _ in input().split()])
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()))

Hsort = sorted(H, reverse=True)

Huse = Hsort[K:]


print(sum(Huse))

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 = sorted(h, reverse=True)
if len(h) > k:
    h = h[k:]
    print(sum(h))
elif len(h) <= k:
    print(0)

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

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

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

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

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

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

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

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

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

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

Solution (Python):
from collections import deque
import sys

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

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

H.sort()
print(sum(H[0:len(H) - k]))

Solution (Python):
import itertools
import math
import fractions
import functools
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort(reverse=True)
if k < n:
    for i in range(k):
        h[i] = 0
else:
    h = [0] * len(h)
print(sum(h))

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

res = H_list[K:]
print(sum(res))

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

print(sum(h[k:]))

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

H.sort(reverse = True)


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

else:
    print("0")

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

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

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

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)
    for i in range(k):
        h_[i] = 0
    print(sum(h_))

Solution (Python):
A,B = list(map(int,input().split()))
s = list(map(int,input().split()))
s1 = sorted(s,reverse = True)
s2 = s1[B::]
print(sum(s2))

Solution (Python):
n, k = list(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()))

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

Solution (Python):

"""
Created on Fri May  8 15:19:53 2020

@author: shinba
"""
from sys import exit

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

if k >= len(h):
    print(0)
    exit()
    
h.sort()

while k > 0:
    h.pop()
    k -= 1

print(sum(h))

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

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

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