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

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

h=sorted(h)

if n<=k:

  print('0')

  exit()

  

for i in range(k):

  h[-i-1]=0

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

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

h.sort(reverse=True)

if n<=k:

  print((0))

  exit()

  

for i in range(k):

  h[i]=0

print((sum(h)))
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))
h = sorted(h)
if n <= k:
    print("0")
    exit()
for i in range(k):
    h[-i - 1] = 0
print((sum(h)))

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

-h = sorted(h) +h.sort(reverse=True) -    print("0") +    print((0)) -    h[-i - 1] = 0 +    h[i] = 0