peterverebics/CodeNet_Python_118 huggingface dataset:
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())))
print(sum([0] + H[:-K]) if K > 0 else sum(H))
n, k = map(int, input().split())
hps = list(map(int, input().split()))

hps = sorted(hps,reverse=True)
hps = hps[k:]
hpsum = int(sum(hps))

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

H_list.sort()

if K >= len(H_list):
  print(0)
  
else:
  for i in range(K):
    H_list[-i - 1] = 0

  print(sum(H_list))
n, k = map(int, input().split())

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

h.sort(reverse=True)

if len(h) >= k:
    ans = sum(h[k:])
else:
    ans = 0

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

H.sort()
H.reverse()
del H[:k]
a=sum(H)
print(a)
N,K = map(int, input().split())
H = list(map(int, input().split()))
H.sort()
for i in range(K):
    H.pop()
    if len(H) == 0:
        break
print(sum(H))
N, K = map(int, input().split())
H = list(sorted(list(map(int, input().split())), reverse=True))
ans = 0
for h in H[K:]:
    ans += h
print(ans)
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)
N, K = map(int, input().split())
H = [int(i) for i in input().split()]

H.sort(reverse = True)

print(sum(H[K:]))
# import itertools
# import math
import sys

# N = int(input())
# S = input()
# n, *a = map(int, open(0))
N, K = map(int, input().split())
H = list(map(int, input().split()))
# Q = list(map(int, input().split()))
# S = input()


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

H.sort(reverse = True)

print(sum(H[K:]))
n, k = map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:n - k]) if k < n else 0)
N, K = map(int, input().split())
H = sorted([int(x) for x in input().split()])[::-1]
print(sum(H[K:]))
import sys
n, k = map(int, input().split())
hp_list = list(map(int, input().split()))
hp_list.sort(reverse=True)

if k >= len(hp_list):
    print(0)
    sys.exit()

hp_list = hp_list[k:]
print(sum(hp_list))
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))
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h.sort()
if k > 0:
    h = h[:-k]
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:
        print(sum(H))
    else:
        print(sum(H[:-K]))
n,k = 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))
n,h=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.reverse()
c=[0]*2
c[0]=h
c[1]=len(a)
for k in range(0,min(c)):
  a[k]=0
print(sum(a))
N, K = map(int, input().split())
H = sorted(list(map(int, input().split())), reverse=True)
print(sum(H[K:]))
def solve():
    N, K = map(int, input().split())
    H = list(map(int, input().split()))
    list.sort(H, reverse=True)
    return sum(H[min(K, N):])

print(solve())
N,K = map(int,input().split())
HH = list(map(int,input().split()))

sHH = sorted(HH,reverse=True)
if N <= K:
    print(0)
else:
    HHsum = sum(sHH[K:])
    print(HHsum)
n,k=map(int,input().split())
h=sorted(list(map(int, input().split())))
res=0
if k>=n:res=0
else:
    res+=sum(h[:n-k])
print(res)
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))

H.sort(key=lambda x: -x)

c = min(K, N)

i = 0
while 0 < c:
    H[i] = 0
    c -= 1
    i += 1

ans = 0
for j in range(i, N):
    ans += H[j]

print(ans)
from sys import stdin

def main():
    n,m = map(int,stdin.readline().split())
    l = list(map(int,stdin.readline().split()))
    l.sort()
    aco = 0
    for i in range(n-m):
        aco+= l[i]
    print(aco)
        
main()
n, k = map(int, input().split())
arr = [int(j) for j in input().split()]
if k>= n:
	print(0)
else:
	arr.sort(reverse=True)
	print(sum(arr[k:]))
n, k = map(int, input().split())
h = [i for i in map(int, input().split())]
c = n - k
if c>0:
    h.sort(reverse=True)
    h = h[-c:]
    print(sum(h))
else:
    print(0)
N, K = map(int, input().split())
HL = sorted(list(map(int, input().split())), reverse=1)

print(sum(HL[K:]))
n, k = map(int, input().split())
h = list(map(int, input().split()))
sh = sorted(h)
new = list()
if n > k:
    for i in range(n-k):
        new.append(sh[i])
    print(sum(new))
else:
    print(0)
n, k = list(map(int,input().split()))
print(sum(sorted(list(map(int,input().split())), reverse = True)[k:]))
n,k=map(int,input().split())
h=sorted(list(map(int,input().split())),reverse=True)
ans=sum(h[k:])
print(ans)
n, k = map(int, input().split())
h = sorted([int(i) for i in input().split()])
if k != 0:
    h = h[:-k]
print(sum(h))
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())
a = sorted(list(map(int, input().split())))
res = 0
if k >= n:
  print(0)
else:
  a = a[:n-k]
  for i in a:
    res += i
  print(res)
x, y = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
while y > 0 and len(a) > 0:
  y -= 1
  a.pop()
  
print(sum(a))
n, k = map(int, input().split())
his = list(map(int, input().split()))
his_sort = sorted(his)
an = 0
if k > 0:
  for i in range(k):
    his_sort.pop()
    if len(his_sort) == 0:
      break
if len(his_sort) > 0:
  for j in range(n - k):
    an += his_sort[j]
print(an)
N, K = map(int, input().split())
H=list(map(int, input().split()))
if K>=N: exit(print(0))
import heapq
H=[-i for i in H]
heapq.heapify(H)

for i in range(K):
	heapq.heappop(H)
print(-sum(H))
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort()
count=0
if N>K:
  for i in range(K):
    count+=H[N-i-1]
  print(sum(H)-count)
else:
  for i in range(N-K):
    count+=H[i]
  print(count)
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))
print(sum(H[:max(N-K,0)]))
N,K=map(int,input().split())
H=sorted(list(map(int,input().split())))
print(sum(H[0:len(H)-K]) if N>K else 0)
n,k = map(int,input().split())
h = sorted(list(map(int,input().split())))
print(0 if n<=k else sum(h[0:n-k]))
inputted = list(map(int, input().split()))
N = inputted[0]
K = inputted[1]
H = list(map(int, input().split()))

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

print(answer)
import math 
import sys 
#t=int(sys.stdin.readline())
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)
n, k = map(int, input().split())
h = list( map(int, input().split()))

h.sort(reverse=True)

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

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

elif(k==0):
    b=sum(h)
    print(b)
elif(k<n):
    b=sum(h[:-k])
    print(b)
import sys
def input(): return sys.stdin.readline().rstrip()

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

if __name__ == '__main__':
    main()
Input1 = list(map(int,input().split()))
H = Input1[0]
K = Input1[1]

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

Ar = Input2


if K > H:
  K = H

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

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

a = sorted(a, reverse = True)
cnt = 0
for i in range(n):
    if i < k:
        continue
    else:
        cnt += a[i]
print(cnt)
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort(reverse=True)
ans=0
ans+=sum(h[k:])
print(ans)
def main():
    N, K = (int(i) for i in input().split())
    H = [int(i) for i in input().split()]
    ans = 0
    H.sort(reverse=True)
    if N <= K:
        return print(ans)
    for h in H[K:]:
        ans += h
    print(ans)


if __name__ == '__main__':
    main()
n,k=map(int,input().split())
h=sorted(list(map(int,input().split())))

if k>=n:
  print(0)
elif k==0:
  print(sum(h))
else:
  print(sum(h[:-k]))
N , K = map(int,input().split())
H = list(map(int,input().split()))
H.sort(reverse=True)
#print(H)
if K>=N:
    print(0)
else:
    print(sum(H[K:]))
n, k = map(int,input().split())
L = [int(i) for i in input().split()]
L.sort(reverse=True)

L = L[k:]
if len(L) > 0:
  s = sum(L)
else:
  s = 0
print(s)
n, k = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
print(sum(H[k: ]))
#!/usr/bin/env python3

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

if K >= N:
    ans = 0
else:
    ans = sum(h_list[K:])

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

H = sorted(H, reverse=True)

print(sum(H[K:]))
import sys
n,k = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
if n<=k:
    print(0)
elif k==0:
    print(sum(a))
else:
    a.sort()
    print(sum(a[:-k]))
n, k = map(int, input().split())
li = list(map(int, input().split()))

ans = 0
li.sort()
for i in range(n-k):
    ans = ans + li[i]
print(ans)
import sys

def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]


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

    if N > K:
        for i in range(N-K):
            ans += Hs[i]
        print(ans)
    else:
        print(0)

if __name__ == "__main__":
	main()
# ABC153C

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)
#入力部
n,k = map(int,input().split())
h = list(map(int,input().split()))

#攻撃:hを1減らす　必殺技:hをすべて減らす制限　k回
#hを降順にソート
h.sort(reverse = True)
#nがkより小さい時全部に必殺技が使えるから0
if n <= k:
    print(0)
#体力が多い順に必殺技を使用して残った体力の合計を出力
else:
    for i in range(k):
        h[i] = 0
    print(sum(h))
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))
N,K=list(map(int,input().split()))
H= list(map(int,input().split()))

y=sorted(H)
y.sort(reverse=True)
x=0

for i in range (K,N):
    x=x+y[i]
    
print(x)
n,k,*a=map(int,open(0).read().split())
a.sort()
a+=[0]
print(sum(a[:~k]))
n,k=map(int,input().split())
hl=list(map(int,input().split()))
ans=0
if n<=k:
    print(0)
else:
    hl.sort(reverse=True)
    temp=hl[(k+1)-1:n]
    for v in temp:
        ans+=v
    print(ans)
n, k = map(int, input().split())
h = list(map(int, input().split()))

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

h.sort()

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

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

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

n,k = nm()
h = nl()
h.sort(reverse=True)
print(sum(h[k:] + [0]))
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)
H,K=map(int,input().split())
L=sorted(list(map(int,input().split())),reverse=True)
if len(L) <= K:
  print(0)
else:
  SL=sum(L)
  MK=sum(L[:K])
  print(SL-MK)
n,k=map(int,input().split())
h=list(map(int,input().split()))
h=sorted(h)
if n<=k:
    print(0)
else:
    ans=0
    for i in range(n-k):
        ans+=h[i]
    print(ans)
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort(reverse=True)
ans = sum(A[K:])
print(ans)
N, K = map(int, input().split())
H = sorted(map(int, input().split()))[:max(0, N-K)]
print(sum(H))
n, k = map(int, input().split())
teki_list = [i for i in map(int, input().split())]

#敵を弱い順に並べる
teki_list.sort()

if k != 0:
    #強いやつに必殺技を使う
    if k <= len(teki_list):
        del teki_list[-k:]
    else:
        del teki_list[:]

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

main()
n,k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
h[:k] = [0]*k
res = sum(h)
print(res)
n,k=map(int,input().split())
lists=list(map(int,input().split()))
lists=sorted(lists)
if len(lists)<=k:
    print(0)
elif len(lists)>k:
    sub=lists[:len(lists)-k]
    print(sum(sub))
N, K = map(int, input().split())
H = list(map(int, input().split()))

H.sort()

if K >= N:
    print(0)
else:
    for _ in range(K):
        H.pop()
    print(sum(H))
n, k = [int(i) for i in input().split()]
print(sum(list(reversed(sorted([int(i) for i in input().split()])))[k:]))
N, K = input().split()
H = input().split()
if int(K) >= int(N):
    print(0)
else:
    attack = 0
    H = list(map(int, H))
    H.sort(reverse = True)
    del H[0:int(K)]
    for x in H:
        attack += x
    print(attack)
N, K = map(int, input().split())
H = [int(x) for x in input().split()]
Ha = sorted(H, reverse=True)
del Ha[:K]
print(sum(Ha))
N,K = input().split()
l = list(map(int, input().split()))

N = int(N)
K = int(K)

l.sort(reverse=True)
if N <= K:
    print(0)
else:
    print(sum(l[K:]))
#!/usr/bin/env python3
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 = list(map(int, input().split()))

count = 0

if N<K:
    print(0)
else:
    # リストをソートする
    H_list = sorted(H_list, reverse=True)
    # 上位K位をスライスで削除
    H_list = H_list[K:]


    # リスト内の残りの数を合計
    count = sum(H_list)
    print(count)
n,k,*hh = map(int, open(0).read().split())

hh.sort(reverse=True)

print(sum(hh[k:]))
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]


N, K = fetch_int_input()
hps = fetch_int_input()

sort_hps = sorted(hps, reverse=True)

remain_hps = sort_hps[K:]
print(sum(remain_hps))
n,k = map(int,input().split())
h = list(map(int,input().split()))

#n,k = 3,3
#h = [1000000000,1000000000,1000000000]

h.sort(reverse=True)
print(sum(h[k:]))
N, K = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
S = 0
for i in range(0, K):
    if len(A) > 0:
        A.pop(-1)
print(sum(A))
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from fractions import gcd
e = enumerate

sys.setrecursionlimit(10**7)
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())
hn = [int(num) for num in input().split()]

hn.sort(reverse = True)
if len(hn) > k:
  print(sum(hn[k:]))
else :
  print(0)
def main(n, k, h):

    h.sort()

    for i in range(k):
        try:
            h.pop()
        except IndexError:
            pass

    print(sum(h))


if __name__ == "__main__":
    n, k = map(int, input().split())
    h = list(map(int, input().split()))

    main(n, k, h)
n,k = map(int,input().split())
if n <= k:
  print(0)
  exit()
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 = input().split(' ')
H = [int(h) for h in H]
H.sort(reverse=True)

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

#K = 1
#N = 3
#An = [4,1,5]

import numpy as np

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

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

print(sum(move))
N, K = map(int, input().split())
H = [int(x) for x in input().split()]
H.sort(reverse = True)
print(sum(H[K:]))
n,k = (int(x) for x in input().split())
h_lst = [int(x) for x in input().split()]
h_lst.sort()
if k != 0:
    del h_lst[(-1)*k:]
print(sum(h_lst))
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
if N-K > 0:
    print(sum(H[:N-K]))
else:
    print(0)
D = list(map(int, input().split()))
H = list(map(int, input().split()))

N, K = D[0], D[1]
NewH = sorted(H, reverse = True)
print(sum(NewH[K:]))
n,k = map(int,input().split())
h = [int(s) for s in input().split()]
h.sort(key=int)
for _ in range(min(k,len(h))):del h[-1]
print(sum(h))
n, k = map(int, input().split())
#print(n,k)

h = list(map(int, input().split()))
#print(h)
h.sort()
#print("sorted = ", h)
h.reverse()
#print(h)
score = 0
for i in range(k, n):
	score = score + h[i]
print(score)
N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
H.sort()
index = max(N-K, 0)
H_K = H[:index]
if not H_K:
    ans = 0
else:
    ans = sum(H_K)
print(ans)
n,k=map(int,input().split())
h=list(map(int,input().split()))
if n<=k:print(0);exit()
h.sort(reverse=1)
print(sum(h[k:]))
import sys
import math
import functools
stdin = sys.stdin
mod = 10**9 + 7

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
sa = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, k = na()
h = na()
h.sort(reverse=True)
h[:k] = [0]*k
print(sum(h))
N, K = map(int,input().split())
H = [int(i) for i in input().split()]
H = sorted(H)[::-1]
cnt = 0
for i in range(K, N):
  cnt += H[i]
print(cnt)
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort(reverse=True)
ans = 0
for i in range(n):
    if i<k:
        continue
    ans += h[i]
print(ans)
N, K = map(int, input().split())
H = list(map(int, input().split()))

H_sorted = sorted(H, reverse=True)

if K <= N:
    del H_sorted[:K]
    print(sum(H_sorted))
else:
    print(0)
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()
h=n1()
if n<=k:
    ans=0
else:
    ans=sum(sorted(h)[:n-k])
print(ans)
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
b.sort()
summ=0
for i in range(0,a[0]-a[1]):
    summ+=b[i]
print(summ)
N,K = map(int, input().strip().split(' '))
A = sorted(list(map(int, input().strip().split(' '))), reverse=True)

print(sum(A[K:]))
n, k = map(int, input().split())
mons = map(int, input().split())

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

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

c = len(l) - k
if c < 0:
    c = 0
    
print(sum(l[:c]))
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
cnt = sum(H) - sum(H[:K])
print(cnt)
N,K=map(int, input().split())
H=list(map(int,input().split()))
count=0
H.sort(reverse=True)
#print(H)
i=K
#print(i)
while i<len(H):
    count=count+H[i]
    i=i+1
    #print(i)

print(count)
n,k = map(int,input().split())
h = list(map(int,input().split()))
h = sorted(h)
print(sum(h[:max(0,n-k)]))
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
if k>=n:
    print(0)
else:
    print(sum(l[:n-k]))
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
cnt = 0
for i in range(n -k):
  cnt += h[i]
print(cnt)
N,K = list(map(int, input().split()))
H = list(map(int, input().split()))

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

for p in range(K):
    if N-p-1 >= 0:
        H[N-p-1] = 0

print(sum(H))
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K, *H = map(int, read().split())

H = sorted(H)[::-1]
cnt = 0
for i in range(min(K, N), N, 1):
    cnt += H[i]

print(cnt)
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)
enemy,special=map(int,input().split())
hps=list(map(int,input().split()))
hps=sorted(hps,reverse=True)
print(sum(hps[special:]))
n,k = map(int,input().split())
h = [int(x) for x in input().split()]
h.sort(reverse=True)
print(sum(h[k:]))
n, k = list(map(int,input().split()))

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

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

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

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

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

for i in range(k):
    if len(h) == 0:
        h.append(0)
        break
    h.pop()

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