peterverebics/CodeNet_Python_118 huggingface dataset:
n,k = map(int, input().split())
L = list(map(int,input().split()))
ans = 0
S = sorted(L)
print(S)
for i in range(n):
    if k > 0:
        del S[-1]
        k = k-1
print(S)
print(sum(S))
N, K = map(int, input().split(' '))
H = sorted(map(int, input().split(' ')))
if(K >= N):
    print(0)
    exit(0)
for j in range(K):
    H[K - j - 1] = 0
print(sum(H))
n,k=map(int,input().split())
h=[int(i) for i in input().split()]
h.sort
a=0
if n-k<=0:
  print(0)
else:
  for j in range(n-k):
    a+=h[j]
  print(a)
N, K = map(int, input().split())
H = list(map(int,input().split()))
if K == 0:
    print(sum(H))
if K >= N:
    print(0)
else:
    print(sum(H[:-K]))
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
if a<=b:
  print(0)
else:
  for i in range(b):
    e=e+c[-b]
  print(d-e)
#n = int(input())
n,k = map(int,input().split())
h_L = list(map(int,input().split()))

h_L.sort()

if k ==0:
    print(sum(h_L))
else:
    print(sum(h_L[k+1:]))
# -*- coding: utf-8 -*-

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

# Proccess
survibe_monster = int(NK[0])-int(NK[1])
killed_monster = int(NK[1])

del HI[:killed_monster]

how_many_attack = 0
for i in range(survibe_monster):
  how_many_attack = how_many_attack + int(HI[i])

# Output                   
print(how_many_attack)
def main():
    n, k = map(int, input().split())
    inlis = list(map(int, input().split()))
    inlis.sort()

    if k >= n:
        print(0)
        exit()
    total = sum(inlis[:-k])
    print(total)

    
if __name__ == "__main__":
    main()
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
if n<k:
    print(0)
    print(h)

else:
    a=h[:-k]
    ans=sum(a)
    print(h,ans)
import math
import sys

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

sum = 0
if (n-k) <= 0:
  print(0)
  sys.exit()
for i in range(n-k):
  sum = sum + int(hlist[i])
print(sum)
n,k = map(int,input().split())
l = input().split()
l = [int(i) for i in l]
for i in l:
    l.remove(max(l))
print(sum(l))
n,k=map(int,input().split())
h=list(map(int,input().split()))
if n<=k:
  print('0')
else:
  h.sort()
  print(sum(h[:-1*k]))
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
print(sum(h[:n-k]))
h,n = map(int,input().split())
g = input().split()
G = sorted([int(j) for j in g])
del G[-n::]
print(sum(G))
input_num=input()
n=input_num.split()
num = list(map(int,n))

if len(num)-2<=num[1]:
  print(0)
else:
  a=num[2:]
  a.sort(reverse=True)
  b=a[num[1]:]
  print(sum(b))
#!/usr/bin/python
# -*- Coding: utf-8 -*-

H, AT = map(int, input().split())
HPs = sorted(map(int, input().split()))
count = 0

# 敵の数 H
# 必殺でHP0 AT回
# 敵HP多い順 HPs

# 残った個体数
left = H - AT
if left > 0:
  for i in range(AT, H):
    count = count + HPs[i]
  print(count)
else:
  print(0)
N , K = map(int, input().split())
H = [int(i) for i in input().split()]


if N <= K:
    print(0)

elif K == 0:
        print(int(sum(H)))

else:
    H.reverse()
    print(int(sum(H[K:N])))
n, k = map(int, input().split())
H = sorted(list(map(int, input().split())))
if n <= k:
  print(0)
else:
  print(sum(H[:k+1]))
N, K = map(int,input().split())
H = list(map(int,input().split()))
if K > len(H):
    print(0)
elif K == 0:
    print(sum(H))
elif K < len(H):
    H.remove(max(H))
    print(sum(H))
N,K = map(int,input().split())
H = list(map(int,input().split()))
for i in range(K):
  maxH = max(H) - K
  if maxH<0:
    maxH =0
  H[H.index(max(H))] = maxH
sumh = sum(H)
print(sumh)
n, k = (int(x) for x in input().split())
H = list(map(int, input().split()))
if k != 0:
    H.sort()
    del H[:k]
print(sum(H))
N,K=map(int,input().split())
H=sorted(map(int,input().split()))


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

if N <= K:
  print(0)
else:
  if K == 0:
    c = sum(H)
  else:
  	c = sum(H[:-K])
  print(c)
N, K = [int(i) for i in input().split()]
mon_list = [int(i) for i in input().split()]
mon_list = sorted(mon_list, reverse=True)
if N <= K:
    output = 0
else:
    if K != 0:
        output = sum(mon_list[:K])
    else:
        output = sum(mon_list)
print(output)
n, a = map(int, input().strip().split())

if n < a:
  print(0)
  
aaa = list(map(int, input().strip().split()))

aaa = sorted(aaa, reverse=True)
h = 0
for i in range(a, n):
  h += aaa[i]
  
print(h)
import math

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

# N monsters
# No.i monster vitalitiy is Hi
# two actions
# attack : reduce 1 vitaility
# special: make vitality 0. Fenek can use K times of specials.

H.sort(reverse=True)

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


r_H = H[K:]


sum_H = 0
for hp in r_H:
    sum_H += hp

print(sum_H)
print(10**9)
print(2*10**14)
# -*- coding: utf-8 -*-

n, k = map(int, input().split())
H = sorted([int(i) for i in input().split()], reverse = True)

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

if K >= N:
    print(0)
elif N > K:
    if K == 0:
        print(sum(int(i) for i in H))
    else:
        H.remove(max(H))
        print(sum(int(i) for i in H))
N, K = map(int, input().split())
H = sorted([int(x) for x in input().split()])[::-1]
print(sum(H[N:]))
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.sort()
ans = sum(h[:n-1*k])

print(ans)
a, b=map(int,input().split())
l=list(map(int,input().split()))
if a<b:
  print(0)
elif a>b:
  l.sort()
  n=l[b:]
  s=sum(n)
  print(s)
n , k = map(int, input().split())
hp = input().split()

sum_hp = 0

hp.sort()

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


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

print(sum_hp)
# get H, A
N, K = map(int, input().split())

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

H = [int(x) for x in input().split()]

if K >= len(H):
    print("0")
elif K == 0:
    print(sum(H))
else:
    remaining = H[0:-K]
    print(sum(remaining))
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()
        del H[0:K]
        print(sum(H))
N , K = map(int, input().split())
H = [int(i) for i in input().split()]


if N <= K:
    print(0)

elif K == 0:
    print('aaa')

else:
    H.reverse()
    print(sum(H[K:N+1]))
N, K = map(int,input().split(' '))
H_ls = list(map(int, input().split(' ')))
print(sum(H_ls[K:]))
#入力:N(int:整数)
def input1():
	return int(input())

#入力:N,M(int:整数)
def input2():
	return map(int,input().split())

#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))


H,K=input2()
h=input_array()

sorted_h=sorted(h)
if len(sorted_h[:-K])<1:
	print(0)
else:
	print(sum(sorted_h[:-K]))
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(H_hissatsued)
  print(sum(H_hissatsued))
#n = int(input())
n,k = map(int,input().split())
h_L = list(map(int,input().split()))

h_L.sort()

print(sum(h_L[k+1:]))
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

intEnemyHp = [int(i) for i in enemyHp]
enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

else:
    for i in range(resultEnemyCount):
        countNormal += intEnemyHp[i]
    print(countNormal)
def add_num(List):
  res=0
  for y in List:
    res += y
  print(res)

N, K=map(int,input().split())
List=list(map(int,input().split()))
if N < K:
  print(0)
elif K is not 0:
  x=List.index(max(List))
  List.pop(x)
  add_num(List)
else:
  add_num(List)
nn, kk = list(map(int,input().split()))
hh = list(map(int,input().split()))

print(nn,kk,hh)

hh.sort()
print(hh[0:nn-1])
print(sum(hh[0:nn-kk]))
N, K = map(int, input().split())

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

if K >= N:
    print(0)
else:
    print(sum(enemies))
N,K = map(int,input().split())
H = list(map(int,input().split()))
H.sort()
H.reverse()
if K==0:
        pass
elif K==1:
        del H[0]
else:
   del H[0:K-1]
a = 0

for i in H:
        a+=i
print(int(a))
N,K=map(int,input().split())
H=sorted(list(map(int,input().split())))
if (N<=K):
   print('O')
else:
   print(sum(H[:N-K]))
x = input().split()
n = int(x[0])
k = int(x[1])

h = input().split()

sorted(h,reverse=True)

if n-k <= 0:
    print(0)
    exit()

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

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

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

H = [int(x) for x in input().split()]
if K != 0:
    remaining = H[0:-K]
else:
    remaining = H

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

s.sort()
print(sum(s[:-k]))
N, K = map(int, input().split())
List = list(map(int, input().split()))


remain_monster = N - K
new_list = sorted(List, reverse=True)

monsterHP = sum(new_list[remain_monster:])

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

H.reverse()

cnt = 0

for i in range(K,len(H)):
    cnt += int(H[i])

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

print(sorted(H)[::-1][K:])
N,K=map(int,input().split())
H=list(map(int,input().split()))
I=sorted(H)
print(H)
print(I)
s=0
if N<=K:
  print(0)
else:
  for i in range(N-K):
    s+=I[i]
  print(s)
n,k=map(int,input().split())
lists=list(map(int,input().split()))
if len(lists)<=k:
    print(0)
elif len(lists)>k:
    sub=lists[:len(lists)-k]
    print(sum(sub))
N, K = map(int,input().split())
A=list(map(int,input().split()))
A.sort()
ans=sum(A[:N-K])
print(ans)
N, K = map(int,input().split())
H = list(map(int,input().split()))
result = 0
if len(H) <= K:
    print(result)
else:
    H.sort()
    result = sum(H[0:N-K-1])
    print(result)
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = sorted(a)
if n <= k:
  print(0)
else:
  c = 0
  t = 0
  while t < n-k:
    c += a[t]
    t += 1
  print(c)
n, k = map(int, input().split())
#print("n={}, k={}".format(n,k))

h = input().split()
#print(h)

hs = sorted(h)
#print(hs)

#攻撃するモンスターの体力のリスト
mon_att = hs[0:len(hs)-k]
#print(mon_att)

#攻撃する回数の最小値
min_att = sum(map(int, mon_att))
print(min_att)
a,b=map(int,input().split())
c=list(map(int,input().split()))

d=sorted(c)
if b==0:
    print(sum(d))
elif a>b:
    n=len(d[0:b])
    del d[0:b+1]
    m=sum(d)
    print(m)
else:
    print(0)
line=input()
data=input()
line=line.split()
data=data.split()
num=0
if int(line[0])<=int(line[1]):
    print(0)
else:
    data=[int(s) for s in data]
    for i in range(len(data)-int(line[1])):
        num+=data[i]
    print(num)
n,k = map(int,input().split())
h = list(map(int,input().split()))

if n < k:
    print('0')

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

print(sum(l))
N,K = (int(x) for x in input().split())
H = list(map(int, input().split()))

sum = 0

H = sorted(H)

answer = 0

for i in H[:N-K]:
    answer += i

print(answer)
from itertools import permutations, combinations

nums = input().split()
As = input().split()
H = nums[0]
N = nums[1]
A = []


N =int(N)

As = list(map(int, As))
As = sorted(As , reverse=True)
N-=1
if N != -1:
    if N == 0:
        N = 1
    del As[:N]

print(sum(As))
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()

intEnemyHp = [int(i) for i in enemyHp]

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

else:
    for i in range(resultEnemyCount):
        countNormal += intEnemyHp[i]
    print(countNormal)
N,K = map(int, input().split())
H = list(map(int, input().split()))
if K == 0:
  print(sum(H))
  pass
H.sort(reverse=True)
result = H[K:]
print(sum(result))
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0


for i in range(resultEnemyCount):
    countNormal += int(enemyHp[i])

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

sumh = sum(h)

if n <= k:
    print(0)
elif k == 0:
    print(sumh)
else:
    for i in range(k):
        sumh -= max(h)
        print(sumh)
n, k = map(int, input().split())
h = sorted(list(map(int, input().split())))

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

H = h[k:]

if len(H) == 0:
  print(0)
elif k == 0:
  print(sum(H))
else:
  print(sum(H)//k)
N,K=map(int,input().split())
H_list=list(map(int,input().split()))
del sorted(H_list)[-K:]
if len(H_list)==0:
  print('0')
else:
  print(sum(H_list))
#体力と必殺技
prm = input().split()
nummons = int(prm[0])
ult = int(prm[1])

#各モンスターのhp
hp = input().split()
hp.sort(reverse=True)
allhp = 0
count = 0

if nummons <= ult:
    print(0)
else:
    for i in range(ult):
        hp[i] = 0
        count += 1

    for chp in hp:
        allhp += int(chp)
    print(allhp)
import math
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
ans=0
if k>=n:
    ans=0
else:
    list_new=l[0:n-k]
    ans_pre=sum(list_new)
print(ans)
args = input().split()
args2 = input().split()
args2.sort()
N = int(args[0])
K = int(args[1])
S = 0

for i in range(N-K):
	S += int(args2[i])

if S <= 0:
	print(0)
else:
	print(S)
# coding: utf-8
# Your code here!

n, k = map(int, input().split())
hs = list(map(int, input().split()))
hs.sort()
if (n <= k):
  print(0)
else:
  print(sum(hs[k:]))
n, k = map(int, input().split())
h = input().split()
l = sorted(h)
if (k >= len(h)):
    b = 0
else:
    m = k*(-1)
    del l[m:]
    b = sum(int(i) for i in l)
print(b)
n, k = map(int, input().split())
h = list(map(int, input().split()))

h.reverse()

a = h[k:]

print(sum(a))
import math


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

K = min(N,K)


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

data.sort()

total = sum( data[0:N-K] )

print(data)
print(total)
N, K = map(int, input().split(' '))
numlist = input().split(' ')
numlist.sort()
if N <= K:
  print(0)
else:
  numsub = numlist[:N - K + 1]
  numsub_i = [int(s) for s in numsub]
  print(sum(numsub_i))
N,K = map(int, input().split())
print(N,K)
H = list(map(int, input().split()))
#H = input().split()
#print(H)
if N<=K:
  print(0)
else:
  # Hの中身を入れ替えて大きいものから順に必殺技で倒す
  # つまり、配列をカットする
  # 配列の残りの和が倒すのに必要な数
  H.sort(reverse=True)
  newH = H[K:]
  sumH = sum(newH)
  print(sumH)
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort()
print(sum(l[:n-k]))
#print(l)
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)
feneck = input().split()
H = input().split()
H_i = [int(h) for h in H]

N = int(feneck[0])
K = int(feneck[1])

list.sort(H_i, reverse=True)

if K < len(H):
  sum = 0
  H_i = H[K:]
  for hp in H_i:
    hp = int(hp)
    sum += hp
  print(sum)
else:
  print(0)
n,k, *h = map(int,open(0).read().split())
h.sort 
if n<k:
  print(0)
else:
  a = h[0: n-k]
  print(sum(a))
a,b=map(int,input().split())
l=list(map(int,input().split()))
l[::-1]
s=0
for i in range(a-b):
  s+=l[i]
print(s)
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
ans=0
for i in range(n-k-1):
  ans+=h[i]
print(ans)
N,K=map(int,input().split())
if K>=N:
	print(0)
	quit()
L = [int(x) for x in input().split()]
L.sort()
if K:
	print(sum(L[:-K]))
print(sum(L))
def get_input_line():
    return list(map(int, input().split()))
n, k = get_input_line()
h_list = get_input_line()

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

for i in range(k):
    h.pop()
    if len(h) == 0:
        break
print(0 if len(h) == 0 else sum(h))
N,K=(int(x) for x in input().split())
a=list(int(y) for y in input().split())
b=sorted(a)
print(sum(b[0:N-K]))
a,b=map(int,input().split())
n=list(map(int,input().split()))
n.sort(reverse=True)
n[0:b-1]=[]
print(sum(n))
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
if k>=n:
  print(k)
else:
  print(k+sum(h[:n-k]))
n,k = map(int,input().split())
h_li = list(map(int,input().split()))
h_li.sort()
print(sum(h_li[:k*-1]))
n, k = map(int, input().split())
h = list(map(int, input().split()))
h2 = sorted(h)
print(sum(h2[:k+1]))
a,b=input().split()
a=int(a)
b=int(b)
c=list(map(int,input().split()))
c.sort()
d=sum(c)
e=0
if a<=b:
  print(0)
else:
  for i in range(b):
    e=e+c[-i]
  print(d-e)
N,K=input().split()
H=input()
H=H.split()
SUM=sum(int(i) for i in H)
if(int(K)>int(N)):
  K=int(N)
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)
else:
  print(LO)
N, K = map(int, input().split())
H = list(map(int,input().split()))
if K == 0:
    print(sum(H))
else:
    print(sum(H[:-K]))
a, b=map(int,input().split())
l=list(map(int,input().split()))
if a<b:
  print(0)
elif a>b:
  l.sort(reverse=True)
  n=l[b:]
  s=sum(n)
  print(s)
n, k = map(int, input().split())
H = sorted(list(map(int, input().split())))
if n <= k:
  print(0)
else:
  print(sum(H[:k]))
N, K = map(int, input().split())
ListH = list(map(int, input().split()))

ListH.sort()
sum=0

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

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

L.sort()
print(sum(L[:N-K]))
n, k = map(int, input().split())
h = input().split()
l = sorted(h)
if (k >= len(h)):
    b = 0
else:
    m = k*(-1)
    f = l[:m]
    b = sum(int(i) for i in f)
print(b)
n, k = (int(z) for z in input().split())
a = [int(z) for z in input().split()]
a.sort()
sm = 0
for i in range(k,n):
  sm += a[i]
print(sm)
n,k=map(int,input().split())
h=list(map(int,input().split()))
if n<=k:
    print(0)
else:
    t=sorted(h)
    t=h[-k:] if k>0 else [0]
    p=sum(h)-sum(t)
    print(p)
N,K = map(int,input().split())
HList = list(map(int, input().split()))
HList.sort()
HList = HList[:0-K]
print(sum(HList))
N, K = map(int,input().split(' '))
H_ls = list(map(int, input().split(' ')))
H_ls.sort()
print(sum(H_ls[K:]))
N,K = map(int,input().split())
H = sorted(list(map(int,input().split())))

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

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

hi=sorted(h)
print(sum(hi[:-k]))
n, k = [int(x) for x in input().split()]

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

if n <= k:
    print("0")
else:
    s_n = sorted(h_n, reverse=True)

    print(sum(s_n[:n - k]))
N,K=map(int,input().split())
h = input().split()
H=[int(i) for i in h]
H=sorted(H,reverse=True)

if __name__=='__main__':
    if (K>=N):
        print(0)
    elif K==0:
        print(sum(H))
    else:
        print(sum(H[-K-1:]))
import sys

n, k, *h = map(int, sys.stdin.read().split())

def main():
    print(sum(sorted(h)[:max(0, n-k)]))
    print(sum([]))

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

n = len(A)
A.sort()
print(sum(A[:n-k]))
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
if n<=k:
    print(0)
else:
    print(sum(a[:-k]))
s=0
n,k=[int(x) for x in input().split()]
arr=[int(x) for x in input().split()]

if(n>k):
    for i in range(n-k):
        s+=arr[i]
    print(s)
else:
  print(0)
enemmyCountN,killerTimeK = map(int,input().split())
enemyHp = input().split()

enemyHp.sort()

resultEnemyCount = enemmyCountN - killerTimeK
countNormal = 0

if killerTimeK >= enemmyCountN:
    print(0)

else:
    for i in range(resultEnemyCount):
        countNormal += int(enemyHp[i])
    print(countNormal)
#体力と必殺技
prm = input().split()
nummons = int(prm[0])
ult = int(prm[1])

#各モンスターのhp
hp = input().split()
hp.sort(reverse=True)
allhp = 0

if nummons <= ult:
    print(0)
else:
    for i in range(ult):
        hp[i] = 0

    for chp in hp:
        allhp += int(chp)
    print(allhp)
import numpy as np

E, H = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))

if H>=E:
  print("0")
else:
  A = np.sort(A)
  Ans = A[:-H].sum()
  print(Ans)
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,k,*hh = map(int, open(0).read().split())

hh.sort()

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

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

h.sort()

h = h[k:]

print(sum(h))
inputs = input().split(" ")

monsters_num, special_moves = int(inputs[0]), int(inputs[1])

health_inp = input().split(" ")
print(health_inp)
monsters_health = [int(h) for h in health_inp]
print(monsters_health)
monsters_health.sort(reverse=True)
print(sum(monsters_health[special_moves:]))
n,k=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
if n<=k:
    print(k)
else:
    ll=l[k:n-1]
    print(sum(ll)+k)
HP, k = map(int, input().split())
enamy = list(map(int, input().split()))

enamy1 = sorted(enamy, reverse=True)
del enamy1[0:k]
print(sum(enamy1)+k)
n,k=map(int,input().split())
H=list(map(int,input().split()))

H.sort()
H.reverse()
print(H)
del H[:k]
a=sum(H)
print(a)
import sys
a,b=map(int,input().split())
c=list(map(int,input().split()))
if a<=b:
  print(0)
  sys.exit()

else:
  f=0
  d=0

  c.sort()
  e=-1
  f=0
  for i in range(a):
    d+=c[i]
  

  for i in range(b):
    if b>0:
      b-=1
      f+=1
      
      d-=c[e]
      e-=1
      if d<=0:
        print(f)
        sys.exit()
      
for i in range(a+e+1):
  f+=c[i]

print(f)
N,K = map(int,input().split())
enemys = list(map(int,input().split()))
enemys = sorted(enemys)
if K >= len(enemys):
  print(0)
else:
  enemys = enemys[K+1:]
  print(sum(enemys))
x = input().split(" ")
n = int(x[0])
k = int(x[1])
h = list(map(int,input().split(" ")))

h.sort(reverse=True)
print(h)

ans = 0
if k >= n:
    print(0)
else:
    for i in range(k,n):
        ans += h[i]
    print(ans)
N, K = map(int,input().split())
Hi = list(map(int,input().split()))
Hi.sort(reverse=True)
print(Hi)
del Hi[:K]
print(Hi)
min_count = sum(Hi)
print(min_count)
N,K=map(int,input().split())
H=list(map(int,input().split()))
H.sort()
print(H)
s=0
if N<=K:
  print(0)
else:
  for i in range(N-K):
    s+=H[i]
  print(s)
N, K = map(int, input().split())
Hs = list(map(int, input().split()))
Hs.sort(reverse=True)
if K > N:
  print(sum(Hs))
else:
  for i in range(K):
    Hs[i] = 0
  print(sum(Hs))
N, K = map(int, input().split())
H = list( map(int, input().split()) )
H.sort()
h = H[:N-K]
print(sum(h))
n,k=map(int,input().split())
h=list(map(int,input().split()))
if len(h)<=k:
  print(0)
else:
  h.sort()
  print(sum(h[:-1*k]))
N,K = map(int, input().split())
res = 0
H = input().split()
H.sort()
numbers = [int(i) for i in H]
for i in range(N-K):
    res += numbers[i]
print(res)