CodeEff/ECCO huggingface dataset:
# Original solution
f = lambda:list(map(int,input().split()))
n, k = f()
l = sorted(list(f()))
k = min(k,n)
print((sum(l[:n-k])))

# Optimized solution
f=lambda:list(map(int,input().split()))
n,k=f()
print((sum(sorted(list(f()))[:max(n-k,0)])))
# Original solution
a = list(map(int,input().split()))
b = list(map(int,input().split()))

b.sort(reverse=True)

if len(b) <= a[1]:
    print("0")
else :
    for i in  range(a[1]):
        del b[0]
    print((sum(b)))


# Optimized solution
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]:])))
# Original solution
N, K = list(map(int, input().split()))
 
list_monster = list(map(int, input().split()))
list_monster.sort(reverse = True) 
 
if N <= K:
  print((0))
  
elif K == 0:
  print((sum(list_monster)))
  
else:
  for i in range(K):
    
    list_monster.pop(0)
 
  print((sum(list_monster)))

# Optimized solution
N, K = list(map(int, input().split()))
 
list_monster = list(map(int, input().split()))
list_monster.sort(reverse = True) 
 
if N <= K:
  print((0))
  
elif K == 0:
  print((sum(list_monster)))
  
else:
  print((sum(list_monster[K:])))
# Original solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
h.sort(reverse=True)
if len(h) < k:
    print((0))
else:
    [h.pop(0) for x in range(k)]
    print((sum(h)))

# Optimized solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
total = 0
h.sort(reverse=True)
for i in range(k,n):
    total += h[i]
print(total)
# Original solution
import sys
n, k = list(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()

for del_num in range(k):
    del hp_list[0]
print((sum(hp_list)))


# Optimized solution
import sys
n, k = list(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)))
# Original solution
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

if len(h) <= k:
  ans = 0
else:
  while k > 0:
    h.remove(max(h))
    k -= 1
  ans = sum(h)
  
print(ans)

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

h = sorted(h, reverse = True)
h = h[k:]
print((sum(h)))
# Original solution
N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
for i in range(K):
    if not H: continue
    max_val = max(H)
    H.pop(H.index(max_val))
print((sum(H)))

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

sort_H = sorted(H)
if N >= K:
    print((sum(sort_H[0:N-K])))
else:
    print('0')
# Original solution
N,K=list(map(int,input().split()))
H=list(map(int,input().split()))
t=list()
for i in range(N-K):
    t.append(sorted(H)[i])
print((sum(t)))

# Optimized solution
N,K=list(map(int,input().split()))
H=list(map(int,input().split()))
t=sorted(H)
n=list()
for i in range(N-K):
    n.append(t[i])
print((sum(n)))
# Original solution
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

h = sorted(h, reverse=True)

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

print((sum(h) if h != 0 else 0))

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

h = sorted(h, reverse=True)

del h[:k]

print((sum(h) if h != 0 else 0))
# Original solution
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)

if k >= len(l):
  print((0))
else:
  print((sum(l[k:])))
  

# Optimized solution
n, k = list(map(int, input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)
print((sum(H[k:])))
# Original solution
#https://atcoder.jp/contests/abc153/tasks/abc153_c

n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
for _ in range(k):
    h[h.index(max(h))]=0
sum=0
for l in h:
    sum+=l
print(sum)

# Optimized solution
#https://atcoder.jp/contests/abc153/tasks/abc153_c

n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
h.sort()
sum=0
for i in range(n-k):
    sum+=h[i]
print(sum)
# Original solution
# -*- coding:utf-8 -*-
n,k = list(map(int, input().split()))
h = []
count = 0

for i in map(int, input().split()):
  h.append(i)

hr = sorted(h, reverse=True)

for l in range(n):
  if l >= k:
    count += hr[l]
print(count)
    

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

h = sorted(h, reverse = True)

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

a = 0
for i in h:
  a += i
print(a)
# Original solution
n,k = list(map(int, input().split()))
h = list(map(int, input().split()))

h = sorted(h, reverse = True)

s = 0
t = 0
for i in h:
  if t < k:
    t += 1
    continue
  s += i
print(s)

# Optimized solution
n,k = list(map(int, input().split()))
h = sorted(list(map(int, input().split())), reverse=True)

print((sum(h[k:])))
# Original solution
H,K=list(map(int,input().split()))
H=list(map(int,input().split()))
d=sum(H)
c=[]
for i in range(K):
  c.append(max(H))
  H.remove(max(H))
  if H.count(max(H))>=2:
    H.append(max(H))
if d-sum(c)>0:
  print((d-sum(c)))
else:
  print((0))
  


# Optimized solution
N,K=list(map(int,input().split()))
H=list(map(int,input().split()))
H.sort()
if N<K:
  print((0))
else:
  print((sum(H[0:len(H)-K])))
# Original solution
N, K = [int(i) for i in input().rstrip().split(' ')]
H = [int(i) for i in input().rstrip().split(' ')]
H.sort(reverse=True)
if len(H) <= K:print((0))
else:
    for hit in range(K):
        if len(H) == 0: break
        H.pop(0)
    print((sum(H)))


# Optimized solution
N, K = [int(i) for i in input().rstrip().split(' ')]
H = [int(i) for i in input().rstrip().split(' ')]
H.sort(reverse=True)
if len(H) <= K:print((0))
else:
    lst = [h for k, h in enumerate(H) if k >= K]
    print((sum(lst)))
# Original solution
n,k = (int(x) for x in input().split())
list = list(map(int,input().split()))
if n>k:
	for i in range(k):
		list.remove(max(list))
	print((sum(list)))
else:
	print((0))

# Optimized solution
n,k = (int(x) for x in input().split())
list = list(map(int,input().split()))
if n>k:
	list2=sorted(list)
	print((sum(list2[:n-k])))
else:
	print((0))
# Original solution
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

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

    exit()

H = sorted(h)

for i in range(k):
    H.remove(H[-1])

print((sum(H)))

# Optimized solution
n, k = list(map(int, input().split()))
H = sorted(list(map(int, input().split())), reverse=True)#reverse=Trueは逆順
# print(H)
# print(H[k:])#後ろからkこぶんとる
print((sum(H[k:])))
# Original solution
n,k = list(map(int,input().split()))
h = list(map(int, input().split()))
if n<=k:
  print("0")
  exit()
for i in range(k):
  h.remove(max(h))
print((sum(h)))

# Optimized solution
n,k = list(map(int,input().split()))
h = list(map(int, input().split()))
if n<=k:
  print("0")
  exit()
new_h = sorted(h)
for i in range(k):
  new_h.pop(-1)
print((sum(new_h)))
# Original solution
n, k = list(map(int, input().split()))
li = list(map(int, input().split()))
ans = 0
kara = []
li.sort(reverse=True)
if n <= k:
  print(ans)
else:
  for i in range(k):
    li.pop(0)

  if li != kara:
    for j in li:
      ans += j

  print(ans)

# Optimized solution
n, k = list(map(int, input().split()))
li = list(map(int, input().split()))
ans = 0
kara = []
if n <= k:
  print(ans)
else:
  li.sort(reverse=True)
  x = li[k:]
  ans = sum(x)

  print(ans)
# Original solution
N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
if K <= len(H):
  for i in range(K):
    H.pop(H.index(max(H)))
  print((sum(H)))
else:
  print((0))

# Optimized solution
N,K = list(map(int,input().split()))
H = list(map(int,input().split()))
newH = sorted(H, reverse=True)
if K <= len(H):
  print((sum(newH[K:len(H)])))
else:
  print((0))
# Original solution
s = list(map(int, input().split()))
h = s[0]
k = s[1]
s = list(map(int,input().split()))
for i in range(k):
    if len(s)>0:
        s.remove(max(s))
    else:
        break
print((sum(s)))

# Optimized solution
s = list(map(int, input().split()))
n=s[0]
k=s[1]
s = list(map(int, input().split()))
s.sort()
if n<k:
    print((0))
else:
    print((sum(s[0:n-k])))
# Original solution
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
if n <= k:
    print((0))
else:
    for i in range(k):
        l.pop(0)
    print((sum(l)))

# Optimized solution
n, k = list(map(int, input().split()))
l = list(map(int, input().split()))
l.sort(reverse=True)
if n <= k:
    print((0))
else:
    print((sum(l[k:])))
# Original solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))

h.sort(reverse = True)

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

    print((sum(h)))

else:
    print("0")

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

h.sort(reverse = True)

if k <= len(h):
    h[0:k] = []
    print((sum(h)))
else:
    print("0")
# Original solution
data  = [int(_) for _ in input().split()]
enemy = [int(_) for _ in input().split()]
#print(type(enemy))
#print(enemy)

if len(enemy) < data[1]:
    print((0))
    exit()

for _ in range(data[1]):
#    print(enemy)
    enemy.remove(max(enemy))
#print(enemy)

print((sum(enemy)))

# Optimized solution
data  = [int(_) for _ in input().split()]
enemy = [int(_) for _ in input().split()]

if len(enemy) < data[1]:
    print((0))
    exit()
elif data[1] == 0:
    print((sum(enemy)))
else:
    enemy.sort()
    
    print((sum(enemy[:-data[1]])))
# Original solution
n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

h = sorted(h)
h[-1:-k-1:-1] = [0,] * min(n, k)

print((sum(h)))

# Optimized solution
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, K = list(map(int, readline().split()))
    H = list(map(int, readline().split()))
    H.sort()

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


if __name__ == '__main__':
    main()
# Original solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
if k > len(h):
    print((0))
else:
    for i in range(k):
        h.remove(max(h))
    print((sum(h)))

# Optimized solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
H = sorted(h, reverse=True)
if k >= len(H):
    print((0))
if k<len(H):
    del H[:k]
    print((sum(H)))
# Original solution
list = input().split(" ")
N = int(list[0])
K = int(list[1])
list_hp = input().split(" ")
list_hp = [int(i) for i in list_hp]
list_hp = sorted(list_hp,reverse=True)

if K < N:
    for i in range(K):
        list_hp.pop(0)
    print((sum(list_hp)))
    
else:
    print((0))

# Optimized solution
list = input().split(" ")
N = int(list[0])
K = int(list[1])
list_hp = input().split(" ")
list_hp = [int(i) for i in list_hp]
list_hp = sorted(list_hp)

if K < N:
    sum = 0
    for i in range(N-K):
        sum = sum + list_hp[i]
    print(sum)
else:
    print((0))
# Original solution
n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
h.sort(reverse=True)
for i in range(k):
  try:
    h.pop(0)
  except IndexError:
    pass
print((sum(h)))

# Optimized solution
n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
h.sort()
for i in range(k):
  try:
    h.pop(-1)
  except IndexError:
    pass
print((sum(h)))
# Original solution
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

for i in range(k):
  max_h = h.index(max(h))
  h[max_h] = 0
cnt = sum(h)
print(cnt)

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

h.sort(reverse=True)
del h[:k]
cnt = sum(h)
print(cnt)
# Original solution
n,k =list(map(int,input().split()))
l = sorted(list(map(int,input().split())))[::-1]
for i in range(min(n,k)):
  l.pop(0)
print((sum(l)))

# Optimized solution
n,k =list(map(int,input().split()))
l = sorted(list(map(int,input().split())))[::-1]
print((sum(l[min(k,n):])))
# Original solution
n, k = list(map(int, input().split()))
H = list(map(int, input().split()))
if k >= n: print((0))
else:
    for i in range(k):
        H.remove(max(H))
    print((sum(H)))

# Optimized solution
n, k = list(map(int, input().split()))
H = list(map(int, input().split()))
if k >= n: print((0))
else:
    H.sort()
    H = H[:n-k]
    print((sum(H)))
# Original solution
N, K = list(map(int, input().split()))

if N <= K:
  print((0))
  
else:
  H = list(map(int, input().split()))
  H.sort()
  H.reverse()
  for i in range(K):
    del(H[0])
 
  c = 0
  for j in range(len(H)):
    c += H[j]
  print(c)

# Optimized solution
N, K = list(map(int, input().split()))

if N <= K:
  print((0))
  
else:
  H = list(map(int, input().split()))
  H.sort()
  H.reverse()
  
  c = 0
  for i in range(K, N):
    c += H[i]
  print(c)
# Original solution
a,b = list(map(int,input().split()))
lis = list(map(int,input().split()))
lis.sort(reverse=True)
if b >= a:
    print((0))
else:
    for i in range(b):
        del lis[0]
    s = sum(lis)
    print(s)

# Optimized solution
a,b = list(map(int,input().split()))
lis = list(map(int,input().split()))
lis.sort(reverse=True)
print((sum(lis[b:])))
# Original solution
n , k = list(map(int, input().split()))
h = [int(i) for i in input().split()]
h.sort()
count = 0
if k >= n:
    print((0))
else:
    print((sum(h[0:n - k])))

# Optimized solution
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
print((sum(sorted(h)[:max(0, n - k)])))
# Original solution
import math
N,K = list(map(int,(input().split())))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K):
    #print(x)
    if (len(L) != 0):
        del L[0]
   # print(L)
print((sum(L)))

# Optimized solution
import math
N,K = list(map(int,(input().split())))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print((sum(L)))
# Original solution
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = list(map(int,read().split()))
N -= K
if N <= 0:
    print((0))
    exit()
    
for i in range(K):
    H.remove(max(H))
    
print((sum(H)))

# Optimized solution
import sys
read = sys.stdin.buffer.read#全部読み込むやつ
readline = sys.stdin.buffer.readline#1行読み込むやつ
readlines = sys.stdin.buffer.readlines#リストで読み込むらしい

N,K,*H = list(map(int,read().split()))
N -= K
if N <= 0:
    print((0))
    exit()
    
H.sort()
    
print((sum(H[: N])))
# Original solution
def testA(n):
    max_num = 0
    for i in n:
        if max_num < i:
            max_num = i
    return max_num
monster, hisatu = list(map(int, input().split()))
m_life = list(map(int, input().split()))
count = 0
if hisatu >= len(m_life):
    print((0))
else:
    while hisatu > 0:
        m_life.remove(testA(m_life))
        hisatu -= 1
    for i in m_life:
        count += i
    print(count)


# Optimized solution
monster, hisatu = list(map(int, input().split()))
m_life = list(map(int, input().split()))
m_life.sort()
count = 0
for i in range(len(m_life)-hisatu):
    count += m_life[i]
print(count)
# Original solution
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))

H_sorted = sorted(H, reverse=True)

for _ in range(K):
    if (not len(H_sorted)):
        break
    H_sorted.pop(0)

print((sum(H_sorted)))


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

H_sorted = sorted(H, reverse=True)

print((sum(H_sorted[K:])))
# Original solution
# N体の敵、K回の必殺技
N, K = list(map(int, input().strip().split(' ')))
N_list = list(map(int, input().strip().split(' ')))
sorted_N = sorted(N_list, reverse=True)

# 必殺技で体力が多い敵からヤる
for i in range(K):
  sorted_N.pop(0)
  if sorted_N == []:
    break

if sorted_N ==[]:
  print((0))
else:
  print((sum(sorted_N)))

# Optimized solution
# N体の敵、K回の必殺技
N, K = list(map(int, input().strip().split(' ')))
N_list = list(map(int, input().strip().split(' ')))
sorted_N = sorted(N_list, reverse=True)

# 必殺技で体力が多い敵からヤる
del sorted_N[:K]

if sorted_N ==[]:
  print((0))
else:
  print((sum(sorted_N)))
# Original solution
n,k = list(map(int,input().split()))
h = sorted(list(map(int,input().split())), reverse=True)
if k >= n:
  print((0))
else:
  for i in range(k):
    h.pop(0)
  print((sum(h)))

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

if N < K:
    K = N
for i in range(K):
    max1 = max(H)
    H.remove(max1)

sum = sum(H)

print(sum)


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

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

print(H_sum)
# Original solution
N, K = list(map(int, input().split()))
h_list = list(map(int, input().split()))

sort_h_list = sorted(h_list, reverse=True)
sort_h_list_length = len(sort_h_list)

for i in range(K):
    if i >= sort_h_list_length:
        break
    sort_h_list.pop(0)

print((sum(sort_h_list)))

# Optimized solution
N, K = list(map(int, input().split()))
h_list = list(map(int, input().split()))

sort_h_list = sorted(h_list, reverse=True)
sort_h_list_length = len(sort_h_list)

print((sum(sort_h_list[K:])))
# Original solution
n,k=list(map(int,input().split()))
lst=list(map(int,input().split()))
total = 0
for i in range(k):
  lst.remove(max(lst))
  if len(lst)==0:
    break;
if len(lst)==0:
  print((0))
else:
  total += sum(lst)
  print(total)

# Optimized solution
n,k=list(map(int,input().split()))
lst=list(map(int,input().split()))
total = 0
lst.sort(reverse=True)
if len(lst)>=k:
  del lst[0:k]
  print((sum(lst)))
else:
  print((0))
# Original solution
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

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

for i in range(k):
    h.remove(max(h))
print((sum(h)))


# Optimized solution
n, k = list(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)))
# Original solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
for i in range(k):
  if i == n:
    break
  h.remove(max(h))
print((sum(h)))

# Optimized solution
n,k = list(map(int,input().split()))
h = sorted(list(map(int,input().split())))
for i in range(k):
  if i == n:
    break
  h.pop(-1)
print((sum(h)))
# Original solution
n, k = list(map(int, input().split()))
h = sorted(map(int, input().split()), reverse=True)
if k == 0:
    print((sum(h)))
elif k < n:
    for i in range(k):
        h.pop(0)
    print((sum(h)))
else:
    print((0))


# Optimized solution
n, k = list(map(int, input().split()))
h = sorted(map(int, input().split()), reverse=True)
if k == 0:
    print((sum(h)))
elif k < n:
    print((sum(h[k:])))
else:
    print((0))
# Original solution
N, K = list(map(int, input().split()))
H = list(map(int, input().split()))

if K <= len(H):
    for i in range(K):
        H.remove(max(H))
else:
    H = [0]
ans = sum(H)
print(ans)

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

a = 0
b = 0
if N <= K:
    ans = 0
else:
    a = N - K

H.sort()
for i in range(a):
    b += H[i]
print(b)
# Original solution
n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
s=sorted(h,reverse=True)
cnt=0
for i in range(n):
    cnt+=s[i]
if k>=n:
  print((0))
  exit()
else:
  for i in range(k):
    cnt-=s[i]
print(cnt)

# Optimized solution
n,k=list(map(int,input().split()))
h=list(map(int,input().split()))
s=sorted(h)
s.reverse()
print((sum(s[k:])))
# Original solution
N, K = (int(x) for x in input().split(' '))
H    = [int(x) for x in input().split(' ')]
#ソート処理
list.sort(H, reverse=True)
#K回最大値をHから消す
while N > 0 and K > 0:
  del H[0]
  N -= 1
  K -= 1
#総和を出力
print((sum(H)))

# Optimized solution
N, K = (int(x) for x in input().split(' '))
H    = [int(x) for x in input().split(' ')]
#ソート処理
list.sort(H, reverse=True)
#K回最大値をHから消す
if N >= K:
  del H[0:K]
else:
  H.clear()
#総和を出力
print((sum(H)))
# Original solution
import sys

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print((0))
  sys.exit(0)
  
H.sort(reverse=True)
for i in range(K):
  del H[0]
for i in range(len(H)):
  ans+=H[i]
print(ans)

# Optimized solution
import sys

N, K = (int(x) for x in input().split())
H = list(map(int, input().split()))
ans=0

if K>=N:
  print((0))
  sys.exit(0)
  
H.sort(reverse=True)
del H[0:K]
for i in range(len(H)):
  ans+=H[i]
print(ans)
# Original solution
import math
import calendar
import fractions
import itertools

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

while k > 0:
    h = h[:-1]
    k -= 1

ans += sum(h)

print(ans)


# Optimized solution
import math
import calendar
import fractions
import itertools

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

if k >= n:
    print((0))
else:
    h = h[:n - k]
    print((sum(h)))
# Original solution
# ABC153B
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 = list(map(int, input().split()))
h = list(map(int, input().split()))
f(n, k, h)

# Optimized solution
# 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 = list(map(int, input().split()))
h = list(map(int, input().split()))
f(n, k, h)
# Original solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))

if n > k:
    for i in range(k):
        h.remove(max(h))
    print((sum(h)))
else:
    print((0))

# Optimized solution
n,k = list(map(int,input().split()))
h = list(map(int,input().split()))
h.sort(reverse=True)

if n > k:
    del h[:k]
    print((sum(h)))
else:
    print((0))
# Original solution
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h.sort(reverse=True)

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


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

h.sort(reverse=True)
print((sum(h[k:])))
# Original solution
H ,K = input().split(" ")
H = int(H)
K = int(K)


lst = input().split(" ")
hps = []
for l in lst:
  hps.append(int(l))

hps.sort(reverse=True)

for k in range(K):
  if hps:
  	hps.pop(0)
  else:
    break

if hps:
  sum_hps = sum(hps)
else:
  sum_hps = 0
print(sum_hps)

# Optimized solution
H ,K = input().split(" ")
H = int(H)
K = int(K)


lst = input().split(" ")
hps = []
for l in lst:
  hps.append(int(l))

hps.sort(reverse=True)

if len(hps) < K:
  hps = [0]
else:
  hps = hps[K:]

sum_hps = sum(hps)
print(sum_hps)
# Original solution
n, k = list(map(int, input().split())) ###n:モンスターの数，k:必殺技の回数
h=list(map(int,input().split())) ###h:モンスターの体力
if k>0:
    for i in range(k):
        if n<=k:
            h.clear()
        else:
            a=max(h)
            h.remove(a)
print((sum(h)))

# Optimized solution
n, k = list(map(int, input().split())) ###n:モンスターの数，k:必殺技の回数
h=sorted(list(map(int,input().split()))) ###h:モンスターの体力

if n<=k:
    print((0))
elif k==0:
    b=sum(h)
    print(b)
else:
    a=sum(h[:-k])
    print(a)
# Original solution
N,K=list(map(int,input().split()))
H = list(map(int, input().split()))
H.sort(reverse=True)

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

print((sum(H)))

# Optimized solution
import sys
input = sys.stdin.readline

def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N,K=MI()
    h=LI()
    
    h.sort()
    
    if K>=N:
        print((0))
        exit()
        
    for i in range(K):
        h[-1-i]=0
        
    ans=sum(h)
    print(ans)

main()