Problem:
Score : 300 points

Problem Statement

Fennec is fighting with N monsters.

The health of the i-th monster is H_i.

Fennec can do the following two actions:

Attack: Fennec chooses one monster. That monster's health will decrease by 1.

Special Move: Fennec chooses one monster. That monster's health will become 0.

There is no way other than Attack and Special Move to decrease the monsters' health.

Fennec wins when all the monsters' healths become 0 or below.

Find the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning when she can use Special Move at most K times.

Constraints

1 \leq N \leq 2 \times 10^5

0 \leq K \leq 2 \times 10^5

1 \leq H_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
H_1 ... H_N

Output

Print the minimum number of times Fennec needs to do Attack (not counting Special Move) before winning.

Sample Input 1

3 1
4 1 5

Sample Output 1

5

By using Special Move on the third monster, and doing Attack four times on the first monster and once on the second monster, Fennec can win with five Attacks.

Sample Input 2

8 9
7 9 3 2 3 8 4 6

Sample Output 2

0

She can use Special Move on all the monsters.

Sample Input 3

3 0
1000000000 1000000000 1000000000

Sample Output 3

3000000000

Watch out for overflow.

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace AtCoder
{
	class Program
	{
		public static void Main()
		{
#if TextInput
			using(var reader = new StreamReader(Debug.SampleTextPath)) 
			{
				Console.SetIn(reader);
#endif
				var intArray = IO.ReadIntArray();
				var hps = IO.ReadLongArray();
				Array.Sort(hps);

				var enemyNum = intArray[0] - intArray[1];
				IO.Write((enemyNum > 0) ? hps.Take(enemyNum).Sum() : 0);
#if TextInput
			}
#endif
		}

		
	}

	public static class IO
	{
		public static string   Read()								 { return Console.ReadLine(); }
		public static string[] ReadArray(char iSplitter = ' ')		 { return Read().Split(iSplitter); }
		public static int	   ReadInt()							 { return int.Parse(Read()); }
		public static int[]	   ReadIntArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => int.Parse(iText)).ToArray(); }
		public static long	   ReadLong()							 { return int.Parse(Read()); }
		public static long[]   ReadLongArray(char iSplitter = ' ')	 { return ReadArray().Select(iText => long.Parse(iText)).ToArray(); }
		public static double   ReadDouble()							 { return double.Parse(Read()); }
		public static double[] ReadDoubleArray(char iSplitter = ' ') { return ReadArray().Select(iText => double.Parse(iText)).ToArray(); }
		public static char[]   ReadCharArray()						 { return Read().ToCharArray(); }

		public static void Write(string iValue)	 { Console.WriteLine(iValue); }
		public static void Write(int iValue)	 { Console.WriteLine(iValue); }
		public static void Write(long iValue)	 { Console.WriteLine(iValue); }
		public static void Write(double iValue)  { Console.WriteLine(iValue); }
		public static void Write(decimal iValue) { Console.WriteLine(iValue); }
		public static void Write(bool iValue)	 { Console.WriteLine(iValue ? "Yes" : "No"); }
		public static void Write<Type>(IEnumerable<Type> iValue , string iJoinWord = " ") { Console.WriteLine(string.Join(iJoinWord , iValue)); }
	}

	public static class Util
	{
		public static long Gcd(long i0 , long i1) { return (i0 > i1) ? _Gcd(i0 , i1) : _Gcd(i1 , i0); }
		public static long Lcm(long i0 , long i1) { return (i0 * i1) / Gcd(i0 , i1); }
		public static long ModPow(long iBaseNumber , long iPow , long iModNumber)
		{
			var num = 1L;
			while(iPow != 0)
			{
				if((iPow & 0x1) != 0)
				{
					num = (num * iBaseNumber) % iModNumber;
				}
				iBaseNumber = (iBaseNumber * iBaseNumber) % iModNumber;
				iPow >>= 1;
			}
			return num;
		}
		public static long CombinationNum(int iLeftNumber , int iRightNumber)
		{
			if(iRightNumber == 0) { return 1; }
			if(iLeftNumber == 0)  { return 0; }
			return iLeftNumber * CombinationNum(iLeftNumber - 1 , iRightNumber - 1) / iRightNumber;
		}
		public static long Factorial(long iNumber)
		{
			if(iNumber == 0) { return 1L; }
			return iNumber * Factorial(iNumber - 1);
		}
		private static long _Gcd(long i0 , long i1)	{ return (i1 == 0) ? i0 : _Gcd(i1 , i0 % i1); }
	}

	public class UnionFind
	{
		public int[] Parents;
		public int[] RootNums;
		public UnionFind(int iRootNum)
		{
			Parents = Enumerable.Range(0 , iRootNum).ToArray();
			RootNums = new int[iRootNum];
		}
		public void Normalize()
		{
			for(var iIndex = 0 ; iIndex < Parents.Length ; ++ iIndex)
			{
				var rootIndex = _GetRoot(iIndex);
				++ RootNums[rootIndex];
				Parents[iIndex] = rootIndex;
			}
		}
		public void Union(int iNumber0 , int iNumber1)
		{
			var rootNumber0 = _GetRoot(iNumber0);
			var rootNumber1 = _GetRoot(iNumber1);
			if(rootNumber0 < rootNumber1)
			{
				Parents[rootNumber1] = rootNumber0;
			}
			else
			{
				Parents[rootNumber0] = rootNumber1;
			}
		}
		public int _GetRoot(int iNumber)
		{
			return (Parents[iNumber] == iNumber) ? iNumber : _GetRoot(Parents[iNumber]);
		}
	}

	public class CumulativeSum
	{
		public static CumulativeSum Create(IEnumerable<long> iNumbers)
		{
			var numbers = iNumbers.ToArray();
			var cumulativeSum = new CumulativeSum
			{
				Numbers = numbers,
				SumNumbers = new long[numbers.Length + 1]
			};
			var sumNumber = 0L;
			for(var iIndex = 0 ; iIndex < numbers.Length ; ++ iIndex)
			{
				sumNumber += numbers[iIndex];
				cumulativeSum.SumNumbers[iIndex + 1] = sumNumber;
			}
			return cumulativeSum;
		}

		public long[] Numbers { get; private set; }
		public long[] SumNumbers { get; private set; }

		public int GetMaxTotalIndex(int iAreaNum)
		{
			var maxIndex = -1;
			var maxNumber = 0L;
			var num = Numbers.Length - iAreaNum + 1;
			for(var iIndex = 0 ; iIndex < num ; ++ iIndex)
			{
				var checkNumber = SumNumbers[iAreaNum + iIndex] - SumNumbers[iIndex];
				if(maxNumber < checkNumber) 
				{
					maxIndex = iIndex;
					maxNumber = checkNumber;
				}
			}
			return maxIndex;
		}
	}
}