peterverebics/CodeNet_Python_118 huggingface dataset:
n,k = map(int, input().split())
L = list(map(int,input().split()))
ans = 0
S = sorted(L,reverse=True)
print(S)
for i in range(n):
    if k > 0:
       # ans += 1 
       k = k-1
    elif k == 0:
        ans = ans+S[i]
print(ans)
h, k = ([int(s) for s in input().split()])
healths = [int(s) for s in input().split()]
healths.sort()
if k == 0:
	print(sum(healths))
to_attack = healths[:-k]

print(sum(to_attack))
n,k = map(int, input().split())
enemy = list(map(int, input().split()))
enemy.sort(reverse=True)
ans = 0
nokori = 0

if k > 0:
    nokori = n-k
else:
    nokori = n

if nokori <= 0:
    print(0)
else:
    if k > 0:
        for i in range(n-k-1,n):
            ans += enemy[i]
    else:
        i = 0
        for i in range(0,n-1):
            ans += enemy[i]
    print(ans)
n, k = map(int, input().split())
s = list(map(int, input().split()))
# s.sort()
if k > len(s):
    k = len(s)
for i in s:
    for j in range(1, k+1):
        s[s.index(max(s))]=0
print(sum(s))
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[K+1:N-1]))
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))

H = H[:K-1]

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

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

if n<=m:
  print(0)
else:
  a=a[-(n-m):]
  print(sum(a))
n, k = map(int, input().split())
h = input().split()
l = sorted(h)
if (k >= len(h)):
    l.clear()
    b = 0
else:
    o = len(h)
    p = o-k
    del l[p:]
    b = sum(int(i) for i in l)
print(b)
N,K = map(int,input().split())
ARR = list(map(int,input().split()))

def calculate(n,k,arr):
    result = 0
    for i in range(n-k):
        result = result + arr[i]

    print(result)

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

enemies = list(map(int, input().split()))[::-1]
enemies = enemies[K:]

print(sum(enemies))
n, k = list(map(int, input().split()))
list_h = sorted(list(map(int, input().split())), reverse=True)

ans = 0
for i in list_h:
    if k > 0:
        k = k - 1
        ans = ans + 1
    else:
        ans = ans + i
print(ans)
N, K = [int(i) for i in input().split()]
H = sorted([int(i) for i in input().split()])

if K < N and  K != 0:
    print(sum(H[: -K]))
elif K > N:
    print(0)
else:
    print(sum(H))
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
if K == 0:
    pass
elif K > N:
    H.clear()
else:
    H = H[(K+1):]
s = sum(H)
print(s)
n,k=map(int,input().split())
h=list(map(int,input().split()))
if len(h)<=k:
  print(len(h))
else:
  h.sort()
  print(sum(h[:-1*k])+k)
import heapq
n,k = map(int,input().split())
h = list(map(int,input().split()))
h = list(map(lambda i: i*(-1),h))
heapq.heapify(h)

if n <= k:
    print(0)
elif k == 0:
    print(sum(h)*(-1))
else:
    for i in range(k):
        heapq.heappop(h)*(-1)
        print(sum(h)*(-1))
n,k=map(int,input().split())
h=list(map(int,input().split()))
if n<=k:
    print(k)
else:

    h.sort(reverse=True)

    print(sum(h[k:]))
eneNum, spNum = map(int, input().split())
eneHp = map(int, input().split())
eneHpList = list(eneHp)

# TLE
#count = 0
#for i in range(spNum):
#    if len(eneHpList) > 0:
#        maxEneHp = max(eneHpList)
#        eneHpList.remove(maxEneHp)

# new method
eneHpList.reverse()
del eneHpList[0:min([spNum, len(eneHpList)])]
count = sum(eneHpList)

print("{}".format(count))
N, K = map(int, input().split())
H = list(map(int, input().split()))

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

h.sort(reverse=True)
count = 0

for hp in h:
    if k >= 1:
        k -= 1
        h.pop(0)
    else:
        count += hp

print(count)
# ABC 153C
import numpy as np
n, k = map(int, input().split())
h = list(map(int, input().split()))
h = np.array(h)

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

H.sort(reverse=True)
if N < K:
    K = N
for i in range(K):
    H[i] = 0
print(H)
ans = sum(H)
print(ans)
N, K, *H = map(int, open(0).read().split())

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

#ListH.sort(reverse=True)
sum=0

if N<=K:
    print(0)
else:
    for i in range(K):
        ListH.remove(max(ListH))
        
    for i in range(N-K):
        sum+=ListH[i]

print(sum)
N, K = map(int, input().split())
H = sorted(map(int, input().split()))
print(sum(H[:N-K]))
import math

EnemyCount, slayeCount = map(int, input().split())
enemyHealths = list(map(int, input().split(" ")))

if EnemyCount < slayeCount:
    slayeCount = EnemyCount

for _ in range(slayeCount):
    del enemyHealths[-1]

print(sum(enemyHealths))
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()
    t = h[n-k:]
    print(sum(t))
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[(n - k - 1):])
    print(attack)
N,K=map(int, input().split())
H=list(map(int, input().split()))
if N<=K:
    print(0)
else:
    if K==0:
        print(sum(H))
    elif K==1:
        H.reverse()
        del H[0]
        print(sum(H))
    else:
        H.reverse()
        for i in range(K):
            del H[0]
        print(sum(H))
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]))
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
print(sum(h[k+1:]))
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = map(int,read().split())
N -= K
if N <= 0:
    print(0)
    exit()
    
H.sort()
    
print(sum(H[:N - K]))
h,n=[int(x) for x in input().split()]
a=list(map(int,input().split()))
sorted(a)
if(n>h):
    print(0)
else:
    a=a[-n:]
    print(sum(a))
n,k = map(int, input().split())
H = list(map(int, input().split()))

H.sort()
H.reverse()

if n <= k:
  print(0)
else:
  print(sum(H[k+1:len(H)]))
n,k = map(int, input().split(' '))
h = list(map(int, input().split(' ')))
h.sort()

print(n)
print(k)
print(h)

s = 0

i = 0
while i < len(h)-k:
  s += h[i]
  i += 1

print(s)
N, K = map(int, input().split())
monsterList = [int(x) for x in input().split()]

atackTimes = 0

monsterList.sort()
if K == 0:
    for hp in monsterList[:-K]:
        atackTimes += hp
else:
    for hp in monsterList:
        atackTimes += hp

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

if N>K:
  for count in range(K):
    H.remove(max(H))
    print(sum(H))
else:
  print(0)
N, K = map(int, input().split())
H = list( map(int, input().split()) )
H.sort()
import numpy as np
h = np.array(H[0:N-K])
print(h.sum())
n,k=map(int,input().split())
print(sum(sorted(list(map(int,input().split())))[:max(0,n-k-(k!=0))]))
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.reverse()

h = h[k:]

print(sum(h))
import sys
n, k = map(int, sys.stdin.readline().split())
h = []
h.extend(sorted(map(int, sys.stdin.readline().split())))

del h[-k:]

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

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

del h[-k:]

print(sum(h))
eneNum, spNum = map(int, input().split())
eneHp = map(int, input().split())
eneHpList = list(eneHp)

# new method
eneHpList.reverse()
del eneHpList[0:spNum]
count = sum(eneHpList)

print("{}".format(count))
H, N = map(int, input().split())
A = [int(x) for x in input().split()]
print(A)
list2 = sorted(A, reverse=True)  # reverseをTrueに
print(list2)
if N>0:
    del list2[0:N]
    print(list2)
    print(sum(list2))
elif N<0:
    print(sum(A))
import sys


def main():
    k = int(input().replace('\n','').split()[1])
    tmp = input().replace('\n','').split()
    tmp.sort(reverse=True)
    n=0
    for i in tmp[k:]:
        n+=int(i)
    print(n)
if __name__ == '__main__':
    input = sys.stdin.readline
    main()
n, k = map(int,input().split())
h = list(map(int,input().split()))
hsort = sorted(h)
ans = sum(hsort[k-n:])
print(ans)
K, H = map(int, input().split())
H = list(map(int, input().split()))
N = len(H)
H.sort(reverse=True)
if K >= N:
    print(0)
else:
    print(sum(H[K:N]))
n, k = map(int, input().split())
h = sorted(map(int, input().split()))[::-1]

print(sum(h[k:]) if k!=1 else k)
n , k = map(int, input().split())
hp = list(map(int, input().split()))

sum_hp = 0

print(hp)
hp.sort()
print(hp)

for i in range(k):
    if(len(hp)> 0):
        hp.pop()

print(hp)

for j in hp:
    sum_hp = sum_hp + int(j)

print(str(sum_hp))
H,N = map(int,input().split())
H = list(map(int,input().split()))

H = sorted(H)
H = H[len(H)-N:]

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

H = sorted(H)
H = H[:len(H)-N]

if N >= len(H):
    print(0)
else:
    print(sum(H))
N, K = map(int,input().split())
Hn = list(map(int,input().split()))

print(sum(Hn[::-1][K:]))
n, k = map(int, input().split(' '))

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

for i in h:
    if k != 0:
        h.remove(max(h))
        k -= 1
        
print(sum(h))
n , k = map(int, input().split())
h = sorted(list(map(int, input().split())), reverse=True)

if k >= len(h):
    H = []
else:
    H = h[k:]

if len(H) == 0:
  print(0)
elif k == 0:
  print(sum(H))
else:
  print(sum(H)//k)
H,N=map(int, input().split())
l=list(map(int, input().split())) 

import math

# H,N=3,1
# l=[4,1,5]

import sys
if N>=len(l):
    print(l)
    sys.exit()

    
sort_l=sorted(l)
delete_l=sort_l[:len(l)-N]
score=0
for i in delete_l:
    score+=(math.ceil(i/H))
print(score)
n,k = list(map(int,input().split()))

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

sum = 0
a.sort()
print(a)
for i in range(min(n,k)): a.pop()
#print(a)
for i in range(len(a)):
    sum += a[i]
print(sum)
import sys
input = sys.stdin.readline

input_line = list(map(int,input().split()))
input_hp = list(map(int,input().split()))

A = sorted(input_hp,reverse=True)
try:
    [A.pop(_) for _ in range(input_line[1])]
    print(sum(A))
except IndexError:
    print('0')
def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    h = sorted(h)

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


if __name__ == '__main__':
    main()
import math
import sys

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

if (n-k) <= 0:
  print(0)
  sys.exit()
sum = 0
for i in range(n):
  if i > k-1:
    sum = sum + int(hlist[i])
print(sum)
n, k = map(int, input().split())
h = list(map(int,input().split()))
if (n-k) > 0:
    m = max(h)
    h.remove(m)
    print(sum(h))
else:
    print("0")
n,k=map(int,input().split())
#hp=list(map(int,input().split()))
hp=[int(x) for x in input().split()]
sorted(hp)
re=sum(hp[:n-k])
print(re)
n,k = (int(x) for x in input().split())
h=list(int(x) for x in input().split())
h.sort()

if n<k:
    print("0")
elif k == 0:
    print(sum(h))
else:
    n = h[:k+1]
    print(sum(n))
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:-1]))
N, K= map(int, input().split())
lists = list(map(int, input().split()))
lists.sort()
if K>=N:
  print(0)
else:
  if K==0:
    SUM = sum(lists)
    print(SUM)
  else:
      del lists[-K:-1]
      SUM = sum(lists)
      print(SUM)
n,k = map(int,input().split())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
if k >= n :
  print(0)
elif k == 0 :
  print(sum(arr))
else :
  for i in range(k) :
    arr[i] = -1
  arr.remove(-1)
  print(sum(arr))
n,k=map(int,input().split())
#hp=list(map(int,input().split()))
hp=[int(x) for x in input().split()]
hp.sort()
re=sum(hp[:n-k])
print(re)
# coding: utf-8
n, k = map(int, input().split())
h = list(map(int, input().split()))
h.sort()
if n <= k:
    print(n)
else:
    print(sum(h[0: n - k]))
n,k = map(int,input().split())
h = list(map(int,input().split()))

h = sorted(h,reverse=True)

attack_n = 0

if k >= n:
    attack_n = 0

else:
    for i in h[n-k-1:]:
        attack_n += i

print(attack_n)
import numpy as np
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort
j=0
if K >= N:
    print(0)
else:
    for i in range (N-K):
        j+=H[i]
    print(j)
n,k = map(int,input().split())
h = list(map(int,input().split()))

del h[n::]
h.sort()
del h[-k:]
print(sum(h))
arr = input().split(" ")
N = int(arr[0])
K = int(arr[1])

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

if(K > 0):
    if(K == 1):
        del HP_arr[:K]
        print(sum(HP_arr))
    else:
        del HP_arr[:K-1]
        print(sum(HP_arr))
else:
    print(sum(HP_arr))
n, k = map(int, input().strip().split())
hs = list(map(int, input().strip().split()))

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

print(sum(h[-k:]) if k != 1 else k)
N,K = list(map(int,input().split()))
H = sorted(list(map(int,input().split())))
s = H[0]
for i in range(1,len(H)-K):
    s += H[i]
print(s)
N,K = map(int,input().split())
enemys = list(map(int,input().split()))
enemys = sorted(enemys,reverse = True)
if K >= len(enemys):
  print(0)
else:
  enemys = enemys[K+1:]
  print(sum(enemys))
# coding: utf-8
# Your code here!

def judge(config , monster_info):
    config = config.split()
    monster_num = int(config[0])
    deathblow_num = int(config[1])
    
    monster_info = monster_info.split()
    monster_info = sorted(monster_info)
    monster_info.reverse()
    monster_info = monster_info[deathblow_num:]
    result = 0
    for num in monster_info:
        result = result + int(num)
    return result
        

def main():
    configration = input()
    information = input()
    answear = judge(configration , information)
    print(answear)
    
if __name__ == "__main__":
    main()
N , K = map(int, input().split())
H = [int(i) for i in input().split()]


if N <= K:
    print(0)

elif K == 0:
        print(sum(H))
else:
    H.reverse()
    print(sum(H[K:N]))
N, K = map(int, input().split())
H = input().split()
total=0
 
if(K==len(H)):
  print(0)
else:
  temp = sorted(H)
  temp = temp[: len(temp)-K]
  for i in temp:
    total+=int(i)
  print(total)
A,B=map(int,input().split())
C=list(map(int,input().split()))
C.sort(reverse=True)
sum(C[B:])
n,k = map(int,input().split())
arr = list(map(int,input().split()))

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

print(sum(arr))
N, K = map(int, input().split(' '))
H = sorted(map(int, input().split(' ')))
print(H)
if(K >= N):
    print(0)
    exit(0)
for j in range(K):
    H[N - j - 1] = 0
print(sum(H))
# -*- coding: utf-8 -*-

# Input
s = [input() for i in range(2)]
NK = list(s[0].split())
HI = sorted(list(s[1].split()))

# Proccess
nk = int(NK[0])-int(NK[1])
del HI[nk:]

sum_h = 0
for i in range(nk):
  sum_h = sum_h + int(HI[i])

# Output							
print(sum_h)
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.reverse

h = h[k:]

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

if N < K:
    times = N
else:
    times = K

H_i = [int(i) for i in H]
H_sum = sum(H_i)

for i in range(times):
    H_sum -= max(H_i)

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

l = h[0:(n-k)+1]

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

h = []
h = list(map(int, input().split()))
h.sort()
sum_h = sum(h[0:-k])
print(sum_h)
a=input().split()
(n,m)=map(int,a)
b=input().split()
b1=list(map(int,b))
b1=sorted(b1)
for i in range(m):
    b1[i]=0
    if i==len(b1)-1:
        break

print(sum(b1))
n,k=map(int,input().split())
a=list(int(x) for x in input().split())
a.sort(reverse = True)
s=0
if k <= n:
	print(0)
else:
		s = sum(a[:n-k])
		print(s)
n,k = map(int,input().split())
h = list(map(int,input().split()))

h.sort()
l = h[0:(n-k)]

print(sum(l))
n, k = map(int, input().split())
h = sorted(map(int, input().split()))
 
x = 0
print(h)
if n - k <= 0:
    print(0)
else:
    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:
    print(sum(H[:N-K]))
# coding utf-8
import math

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

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

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

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

A.sort
if N > K:
  for i in range(K):
    A.pop()
  print(A)
else:
  print("0")
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
if n>k:
  ans=0
  for i in range(n-k-1):
    ans+=h[i]
  print(ans)
else:
  print(0)
N,K=input().split()
H=input()
H=H.split()
SUM=sum(int(i) for i in H)
A=(sorted(H, reverse=True)[:int(K)])
ASUM=sum(int(i) for i in A)
LO=int(SUM)-int(ASUM)
if(int(LO)<0):
  print(0)
elif(K>N):
  print(0)
else:
  print(LO)
n, k = map(int, input().split())
h = list(map(int, input().split()))
sorted(h)
s = 0
for i in range(k):
    try:
        h.pop()
    except:
        pass
if len(h) == 0:
    print(0)
else:
    for x in h:
        s += x
    print(s)
N, K= map(int, input().split())
Nli = [int(x) for x in input().split()]
Nli.sort()

print(sum(Nli[0:N-K]))
N = list(map(int,input().rstrip().split()))
n = N[0]
k = N[1]

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

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

h.sort(reverse=True)

cnt=0
for i in range(1,n):
  cnt += h[i]

print(cnt+1)
N, K = map(int, input().split())
H = input().split()
total=0
 
if(K>=len(H)):
  print(0)
else:
  temp = sorted(H)
  temp = temp[: len(temp)-K]
  for i in temp:
    total+=int(i)
  print(total)
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
hs=sum(h)-sum(h[-k:])
print(hs)
N,K = map(int,input().split())
N = list(map(int,input().split()))
if K == 0:
    print(sum(N))
    exit()
if len(N) < K:
    print(0)
    exit()
N.sort()
for i in range(K):
    N.pop(-1)
for i in range(K):
    print(sum(N))
N, K = map(int, input().split())
life = list(map(int, input().split()))

Nlife = sorted(life)


if K >= 1:
  del Nlife[:K+1]
  

answer = sum(Nlife)

print(answer)
# https://atcoder.jp/contests/abc153/tasks/abc153_c
import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n, k = map(int, input().split())
    hl = list(map(int, input().split()))
    hl.sort()
    hl = hl[:k]
    print(sum(hl))
    return 


if __name__ == '__main__':
    main()
h,k = map(int,input().split())
lst = list(map(int,input().split()))
lst.sort()
print(sum(lst[:len(lst)-k]))
h,n=map(int,input().split())
lists=list(map(int,input().split()))
if h>sum(lists):
    print("No")
else:
    print("Yes")
N, K = map(int, input().split())
H = input().split()
total=0
 
if(K==len(H)):
  print(0)
else:
  temp = sorted(H)
  while K>0:
    temp=temp[:-1]
    K-=1
  for i in temp:
    total+=int(i)
  print(total)
N, K = map(int, input().split())
nums = list(map(int, input().split()))
nums.sort()
if len(nums) <= K:
  print(len(nums))
else:
  nums = nums[K-1:]
  print(sum(nums))
N,K = map(int, input().split())
A = list(map(int, input().split()))

A.sort
if N >= K:
  for i in range(K):
    A.pop()
  print(A)
else:
  print("0")
n,k=map(int,input().split())
a=list(int(x) for x in input().split())
a.sort()
s=0
if k <= n:
	print(0)
else:
		s = sum(a[:n-k])
		print(s)
n,k=map(int,input().split())
H=list(map(int,input().split()))
H2=H[::-1]
for i in range(k):
    if len(H2)>0:
        H2.pop(len(H2)-1)
print(sum(H2))
N, K = map(int, input().split())
Hlist = list(map(int, input().split()))
Hlist.sort(reverse=True)
if K == 0:
  print(sum(Hlist))
elif K == 1:
  del Hlist[0]
  print(sum(Hlist))
else:
  del Hlist[0:K-1]
  print(sum(Hlist))
n, k = [int(x) for x in input().split()]

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

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

s_n = sorted(h_n)

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

if k>=9:
    print(0)
else:
    print(sum(arr[k:]))
n,k=map(int,input().split())
h=[int(i) for i in input().split()]
h.sort
a=0
if n>k:
  for j in range(n-k):
    a+=h[j]
  print(a)
else:
  print(0)
N, K = map(int, input().split())
H = list(map(int, input().split()))

H.sort()

print(sum(H[:-K]))
N, K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
if K == 0:
    pass
elif K <= N:
    H = H[(K+1):]
elif K > N:
    H.clear()
print(sum(H))
n, k = map(int,input().split())
h = list(map(int,input().split()))
h.sort(reverse=True)
if n <= k:
    print(0)
else:
    for i in range(k):
        h.pop(0)
        print(sum(h))
N, K = map(int, raw_input().split())

enemies = list(map(int, raw_input().split()))[::-1]
enemies = enemies[K:]

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

if k == 0:
    print(sum(H))
    exit()

H.sort(reverse=True)
del H[:k + 1]
if not H:
    print(0)
else :
    print(sum(H))
n, k, *h = map(int, open(0).read().split())

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

h.sort()

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

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

sorted(h)

for i in range(k):
  if(len(h) == 0):
    break
  h.pop()
  
print(sum(h))
inputa = input()

n,k= inputa.split()
K=int(k)
N=int(n)
inputb=input()
Monsters=inputb.split()
Monsters.sort(reverse=True)
# print(Attacks)
cnt=0
M=len(Monsters)
if(M>K):
    MonstersRem=Monsters[K:]
    for i in range(len(MonstersRem)):
      cnt=cnt+int(MonstersRem[i])
else:
    cnt=0
    
print(cnt)
N,K = map(int,input().split(' '))
x = 0
h = input().split(' ')
H = sorted(h,reverse=True)
for i in range(K):
    if len(H) == 0:
        break
    else:
        H.pop(0)
for i in range(len(H)):
    x = x + int(H[i])
print(x)
NK = input().split()
N = int(NK[0])
K = int(NK[1])
Hs = input().split()
Hs = [int(h) for h in Hs]

import numpy as np
Hs = np.array(Hs)
Hs = np.sort(Hs, kind="quick_sort")
s = np.sum(Hs[0:-K]) if K < N else 0
print(s)
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)[k-1:]
print(sum(a))
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 = map(int, input().split())
H = list(map(int, input().split()))
H.sort
s = 0
for i in range(0,N-K):
    s = s+H[i]
print (s)
n,k = map(int,input().split())
h = list(map(int,input().split()))

sorted(h)

for i in range(k):
  if(len(h)==0):
    break
  h.pop()
  
print(sum(h))
n,k = map(int, input().split())
enemy = list(map(int, input().split()))
enemy.sort(reverse=True)
ans = 0
nokori = 999

if k > 0:
    nokori = n-k

if nokori <= 0:
    print(0)
else:
    if k > 0:
        for i in range(n-k-1,n):
            ans += enemy[i]
    else:
        i = 0
        for i in range(0,n-1):
            ans += enemy[i]
    print(ans)