peterverebics/CodeNet_Python_118 huggingface dataset:
n,k,*h=map(int,open(0).read().split())
if k>=n:
  print(0)
  exit()
h.sort(reverse=True)
for i in range(k):
  h[i]=0
print(sum(h))
h,n=map(int,input().split())
a = list(map(int,input().split()))

a.sort(reverse=True)


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

if N <= K:
  print(ans)
else:
  H.sort(reverse=True)
  del H[:K]
  ans = sum(H)
  print(ans)
N,K=map(int,input().split())
H=sorted(list(map(int,input().split())),reverse=True)
if N<K:K=N
for i in range(K):H[i]=0
print(sum(H))
import math 
n, k = map(int, input().split())
yes = 'Yes'
no = 'No'
h = list( map(int, input().split()))
h = sorted(h, reverse=True)
if len(h) <= k:
  print(0)
else:
  print(sum(h[k:]))
N, K = map(int, input().split())

H_list = [i for i in map(int, input().split())]

sorted_H_list = sorted(H_list)

if N <= K:
	print("0")
elif K == 0:
	print(sum(sorted_H_list))
else:
	print(sum(sorted_H_list[:-K]))
n,k = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)

for i in range(min(k,n)):
    H[i] = 0

print(sum(H))
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,k=mp()
h=sorted(lmp())
if n<=k:
    print(0)
else:   
    print(sum(h[:n-k]))
import math

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

h.sort(reverse=True)

if n <= k:
    print(0)
else:
    x = n - k
    del h[0:k]
    ans = sum(h)
    print(ans)
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
idx = max(N-K,0)
print (sum(H[:idx]))
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())))

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()
s = 0
for i in range(N-K):
  s += H[i]
print(s)
N, K = map(int, input().split(' '))
H_list = list(map(int, input().split(' ')))

H_list.sort(reverse = True)

del H_list[0:K]

print(sum(H_list))
import sys

def main():

    # sys.stdin = open('input153c.txt')

    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)

if __name__ == '__main__':
    main()
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()))

if n<k :
    print(0)
else:
    print(sum(sorted(h)[:n-k]))
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
print(sum(h[:max(0, len(h) - k)]))
n, k = map(int, input().split())
h = list(map(int, input().split()))
monster = sorted(h, reverse=True)
surviver = monster[k:len(monster)]
print(sum(surviver))
n,k = map(int, input().split())
hl = list(map(int, input().split()))

hl.sort(reverse=True)

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

rem_hl = hl[k:]
rem_sum = sum(rem_hl)
print(rem_sum)
n, k = map(int, input().split())
h = list(map(int, input().split()))

if k >= n:
  print(0)
else:
  h.sort()
  count = 0
  for _ in range(len(h) - k):
    count += h[_]
  print(count)
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())))#小から右へ
ans = 0
if n-k-1 >= 0:
    print(sum(h[:n-k]))
    exit()
print(ans)
import sys
n, k = map(int, sys.stdin.readline().split())
li = list(map(int, sys.stdin.readline().split()))
l = len(li)
t = 0
if l > k:
  li.sort()
  li.reverse()
  t = sum(li[k:])
print(t)
# import itertools
# import math


def solve(N, K, H):
    H.sort(reverse=True)
    if N <= K:
        return 0

    for i in range(K):
        H[i] = 0
    return sum(H)


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

# P = []
# S = []
# for i in range(N):
#     pp, ss  = map(int, input().split())
#     P.append(pp)
#     S.append(ss)

print(solve(N, K, H))
n,k=map(int,input().split())
hs=list(map(int,input().split()))
hs.sort()
print(sum(hs) if k==0 else sum(hs[:-k]))
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))
n,k=map(int,input().split())
h=list(map(int,input().split()))
c=0
if n<=k:
  print("0")
else:
  h.sort()
  for i in range(k):
    h.pop(-1)
  for x in h:
    c+=x
  print(c)
n, k = map(int, input().split(" "))
h = list(map(int, input().split(" ")))
h = sorted(h)

if n > k:
    print(sum(h[0: n-k]))
if n <= k:
    print(0)
N,K = map(int, input().split())
H = [int(a) for a in input().split()]

ans = 0
H.sort(reverse=True)
for i in range(N):
    if i < K:
        continue
    else:
        ans += H[i]

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

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

print(sum(sorted(h, reverse=True)[k:]))
N,K=map(int,input().split())
a=list(map(int,input().split()))
if K>=N:
	print(0)
else:
	b=sorted(a)
	c=0
	for i in range(N-K):
		c+=b[i]
	print(c)
#abc153c
n,k=map(int,raw_input().split())
h=map(int,raw_input().split())
h.sort(reverse=True)
if n<=k:
 print 0
else:
 print sum(h[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()))
if n <= k:
  print("0")
else:
  h.sort(reverse=True)
  h_new = h[k:]
  print(sum(h_new))
N, K = map(int, input().split())
H = list(map(int, input().split()))

H = sorted(H, reverse=True)

del H[:K]
if H:
  total = sum(H)
else:
  total = 0

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

n = sum(h[k:])

print(n)
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)
n, k = map(int, input().split())
H = sorted(list(map(int, input().split())), reverse=True)

print(sum(H[k:]))
A,B = list(map(int,input().split()))
s = list(map(int,input().split()))
s1 = sorted(s,reverse = True)
s2 = s1[B::]
print(sum(s2))
n, k = map(int, input().split())
hp_list = list(map(int, input().split()))
hp_list.sort()

attack = 0
for i, hp in enumerate(reversed(hp_list)):
  if i < k:
    continue
  attack += hp
print(attack)
from heapq import heapify, heappush, heappop
N, K = map(int, input().split())
H = list(map(int, input().split()))

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

print(-sum(H))
m, n = map(int, input().split())
li = list(map(int, input().split()))
if n >= m:
  print(0)
elif n == 0:
  print(sum(li))
else:
  print(sum(sorted(li)[:-n]))
a, b = map(int, input().split())
c = list(map(int, input().split()))
c = sorted(c, reverse=True)
d = 1
ans = 0
for i in c:
    if(d<=b):
        d+=1
    else:ans+=i
    #print(i)
print(ans)
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_list = list(map(int, input().split()))

H_list = list(reversed(sorted(H_list)))

H_list = H_list[K:]

print(sum(H_list))
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
if k>=n:
  print(0)
else:
  print(sum(h[:n-k]))
H, K = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort(reverse=True)
ans = 0
for i in range(K,len(arr)):
    ans += arr[i]
print(ans)
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))
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))
if __name__ == '__main__':
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    H = sorted(H)[::-1]
    cnt = 0
    for h in H:
        if K>0:
            K -= 1
        else:
            cnt += h
    
    print(cnt)
import numpy as np
n, k = [int(i) for i in input().split()]
h = np.array(sorted([int(i) for i in input().split()], reverse=True))
print(sum(h[k:]))
n, k  = map(int, input().split())
h = sorted(map(int, input().split()))
# print(h)
if k >= len(h):
    k = len(h)
for _ in range(k):
    h.pop(-1)

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

H.sort(reverse=True)

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

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

H.sort(reverse=True)
print(sum(H[K:]))
n,k = [int(x) for x in input().split()]
arr = [int(x) for x in input().split()]

print(sum(sorted(arr)[::-1][k:]))
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
print(sum(h[:max(0,n-k)]))
n, k = map(int, input().split())
h = sorted(list(map(int, input().split())))
if k == 0:
    print(sum(h))
else:
    print(sum(h[:-k]))
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())),reverse = True)
print(sum(H[K:]))
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)
N, K = map(int, input().split())
H = list(map(int, input().split()))
 
if N <= K:
	print(0)
else:
	H.sort()
 
	res = 0
	for i in range(N - K):
		res += H[i]
	print(res)
N, K = [int(i) for i in input().split(' ')]
H = sorted([int(i) for i in input().split(' ')], reverse=True)
print(sum(H[K:]))
n,k=map(int,input().split())
if n<k:
  k=n
h=list(map(int,input().split()))
h.append(0)
h.sort()
for i in range(k):
  h.pop(-1)
print(sum(h))
N, K = map(int,input().split())
H = list(map(int, input().split()))

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

y=sorted(x,reverse=True)

print(sum(y[n:]))
N,K=map(int,input().split())
H=list(map(int, input().split()))
if N<=K:
    print("0")
else:
    H.sort()
    count=sum(H[0:N-K])
    print(count)
N, K = [int(i) for i in input().split(" ")]
H = [int(i) for i in input().split(" ")]
H.sort()

monster = H[0:N-K]

if K >= N:
    print(0)
else:
    print(sum(monster))
def main2():
    n, k = list(map(int, input().split()))
    monsters = list(map(int, input().split()))
    monsters.sort(reverse=True)

    for i in range(k):
        if i >= len(monsters):
            break
        monsters[i] = 0
    print(sum(monsters))

if __name__ == '__main__':
    main2()
def main():
    N,K = (int(x) for x in input().split())
    h = list(map(int, input().strip().split()))
    H = sorted(h, reverse=True)
    del H[:K]
    print(sum(H))


if __name__ == '__main__':
    main()
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)
i = 0
kaisuu = 0


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

j = i

for j in range(j, n):
    kaisuu = kaisuu + h[j]

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

if n <= k:
    print(0)
    exit()
del h[0:k]
print(sum(h))
N, K = map(int, input().split())
H    = list(map(int, input().split()))

H = sorted(H, reverse=True)

print(sum(H[K:]))
n,k=map(int, input().split())
list1=list(map(int,input().split()))
list1.sort()
if k >= n:
    print(0)
else:
    sum1=0
    for i in range(n-k):
        sum1+=list1[i]
    print(sum1)
n,k=map(int,input().split())
h_list=[int(i) for i in input().split()]

h_list.sort()
print(sum(h_list[:n-k]) if n>k else 0)
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inm = lambda: map(int, sys.stdin.readline().split())
inl = lambda: list(inm())
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))

n, k = inm()
H = inl()
H.sort()


def solve():
    if k >= n:
        return 0
    return sum(H[: n - k])


print(solve())
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N,K = LI()
    H = sorted(LI(),reverse=True)
    H_removed = H[K:]
    print(sum(H_removed))


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

if(K >= N):
    print(0)
else:
    Hs = sorted(H)
    if(K != 0):
        print(sum(Hs[0:-K]))
    else:
        print(sum(Hs))
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)
n,k=map(int, input().split())
h=list(map(int, input().split()))
h.sort(reverse=True)
ans=sum(h)
if n>k:
  for i in range(k):
    ans=ans-h[i]
else:
  ans=0
print(ans)
from collections import Counter
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)

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

print(sum(h))
N, K = map(int, input().split())
H = [int(x) for x in input().split()]
H = sorted(H)
ans = 0
for i in range(N - K):
    ans += H[i]
print(ans)
import math
N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
H = sorted(H,reverse=True)
print(sum(H[K:]))
n,k = map(int,input().split())
h = list(map(int,input().split()))
if k>=n:
    print(0)
    exit()
h = sorted(h,reverse=True)
f = h[k:]
print(sum(f))
n, k = map(int, input().split())
a = sorted(map(int, input().split()))
print(sum(a[0 : max(0, n - k)]))
N,K=map(int,input().split())
H=list(map(int,input().split()))
newlist=sorted(H,reverse=True)
del newlist[0:K]
print(sum(newlist))
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 = sorted(list(map(int,input().split())))

if not N <= K:
    print(sum(H[0:N-K]))
else:
    print(0)
N, K = list(map(int,input().split()))
H = list(map(int,input().split()))
H = sorted(H)[::-1]
ans = sum(H[K:])
print(ans)
h, n = map(int, input().split())
k = list(map(int, input().split()))
 
k = sorted(k,reverse=True)

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

h_sorted = sorted(h)
# kが0だった場合のルーチン
if(k == 0):
	print(sum(h_sorted))
else:
	print(sum(h_sorted[:-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 = list(map(int, input().split()))
h.sort()
ans = 0
if len(h) == n:
    for i in range(k):
        try:
            h.pop()
        except:
            pass
    for x in h:
        ans += x
    print(ans)
N,K = map(int,input().split())
alist = list(map(int,input().split()))
alist.sort(reverse=True)
p = 0
for i in range(K,N):
    p = p + alist[i]
print(p)
n, k = map(int, input().split())
list = list(map(int, input().split()))

if k>=n:
	print(0)
else:
	list.sort()
	ans = sum(list[:n-k])
	print(ans)
from math import ceil
n, k = map(int, input().split())
h_array = sorted([int(x) for x in input().split()])
if k >= n:
    print(0)
    exit()
print(sum(h_array[:n-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())
hn = list(map(int, input().split()))

if k >= n:
  print(0)
else:
  hn.sort(reverse=True)
  print(sum(hn[k:]))
N,K=(int(x) for x in input().split())
H = list(map(int, input().split()))

H.sort()

H_= H[:-K]


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

h=sorted(h)

if len(h) <= k:
    print(0)
else:
    buf=h[0:len(h)-k]
    """for i in range(k):
       del h[-1]"""
    print(sum(buf))
n,k = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
H.reverse()
print(sum(H[k:]))
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())))
if N <= K:
    print('0')
elif K == 0:
    print(sum(H))
else:
    print(sum(H[:N - K]))
n, k = map(int, input().split())
h = list(map(int, input().split()))

if k >= n:
    print(0)
else:
    new_h = sorted(h)
    weak = list(new_h[:n-k])
    print(sum(weak))
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:]))
N, K = map(int, input().split())
H = list(map(int, input().split()))

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

ans = 0

def quicksort(a):
  if len(set(a)) < 2:
    return a
  left = []
  center = a.pop(0)
  right = []
  for i in a:
    if i > center:
      right.append(i)
    else:
      left.append(i)
  left = quicksort(left)
  right = quicksort(right)
  left.append(center)
  left.extend(right)
  return left

H = quicksort(H)

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

print(ans)
N, K = map(int,input().split())
Hn = list(map(int,input().split()))

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

print(sum(H_sorted))
n, k = map(int, input().split())
ls = list(map(int, input().split()))

ls.sort()

if k == 0:
    print(sum(ls))
else:
    print(sum(ls[:(-1) * k]))
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 + 1 <= K:
        continue
    ans = ans + H[i]

print(ans)
N, K = map(int, input().split())
hhh = list(map(int, input().split()))
hhh.sort()
print(sum(hhh[:-K]) if K > 0 else sum(hhh))
a,b = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse = True)
if b>=a:
    print(0)
else:
    print(sum(arr[b:]))
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

ans = 0
for i in range(n):
  ans += h[i]
  
print(ans)
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::]))
N,K = map(int,input().split())
hitpoint = list(map(int,input().split()))
hitpoint.sort(reverse=True)
if N<=K:
    print(0)
else:
    print(sum(hitpoint[K:]))
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)
n,k = map(int, input().split())
a = list(map(int,input().split()))
 
list_a = sorted(a, reverse = True)
 
if k >= n:
    print(0)
else:
    attack = sum(list_a[k:])
    print(attack)
n, k = [int(v) for v in input().split()]
hps = sorted([int(v) for v in input().split()], reverse=True)

print(sum(hps[k:]))
n,k=map(int,input().split())
A=list(map(int,input().split()))
A=sorted(A)
if(k>=n):
  print(0)
else:
  print(sum(A[:n-k]))
first = input().split(' ')
skills_count = int(first[1])

second = input().split(' ')
healths = [int(s) for s in second]
healths.sort(reverse=True)

print(sum(healths[skills_count:]))
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())),reverse=True)
if n<=k:
    print("0")
else:
    print(sum(h[k:]))
N, K = input().split()
N = int(N)
K = int(K)

h_i = input().split()
h_i = [int(N) for N in h_i]
h_i.sort()
if N < K:
    print("0")
else :
    newh_i = h_i[0:N-K]
    print(sum(newh_i))
import collections
n, k = map(int, input().split())
dat = list(map(int, input().split()))
dat.sort(reverse=True)
dat = collections.deque(dat)
res = 0
#print(dat)
for _ in range(min(k, len(dat) )):
    _ = dat.popleft()
    #print(dat)

res += sum(dat)
#print(dat)
print(res)
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 = [h for h in map(int, input().split())]
H.sort()
if N-K <= 0:
    print(0)
else:
    print(sum(H[:N-K]))
N, K = map(int, input().split())
H = list(map(int, input().split()))

H.sort(reverse=True)

print(sum(H[K:]))
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
h_list=list(map(int,input().split()))
h_list.sort()
if k>=n:
    print(0)
else:
    ans=0
    for i in range(n-k):
        ans+=h_list[i]
    print(ans)
n,k=map(int,input().split())
h=list(map(int,input().split()))
hh=sorted(h)
if(n<=k):
    print(0)
else:
    print(sum(hh[:(n-k)]))
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
#print(H)
H = H[K:]
#print(H)

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

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

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

for _ in range(k):
    H.pop()
ans = sum(H)
print(ans)
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]))