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

namespace Contest
{
    partial class Program
    {
        static void Main(string[] args)
        {
            ABC153_C();
        }


        static void ABC153_A()
        {
            var ha = ReadIntN();
            Console.WriteLine((ha[0] + ha[1] - 1) / ha[1]);
        }
        static void ABC153_B()
        {
            var hn = ReadIntN();
            var a = ReadIntN();
            Console.WriteLine(hn[0] <= a.Sum() ? "Yes" : "No");
        }
        static void ABC153_C()
        {
            var nk = ReadIntN();
            var h = ReadLongN();
            var N = nk[0];
            var K = nk[1];
            h = h.OrderBy(x => x).ToArray();
            Console.WriteLine(h.Take(N <= K ? 0 : N - K).Sum());
        }
        static void ABC153_D()
        {
            var H = ReadLong();
            long n = 1;
            while (H >= n)
            {
                n *= 2;
            }
            Console.WriteLine(n - 1);
        }
        static void ABC153_E()
        {
            var hn = ReadIntN();
            int H = hn[0];
            int N = hn[1];
            var ab = ReadTupleLong(N);
            var A = ab.Select(x => x.Item1).ToArray();
            var B = ab.Select(x => x.Item2).ToArray();
            long[] minMagic = new long[H + 1];
            minMagic[0] = 0;
            for(int i = 1; i < minMagic.Length; ++i)
            {
                minMagic[i] = Int32.MaxValue;
                for(int n = 0; n < N; ++n)
                {
                    var h0 = A[n] >= i  ? 0 : minMagic[i - A[n]];
                    minMagic[i] = Math.Min(minMagic[i], B[n] + h0);
                }
            }
            Console.WriteLine(minMagic[H]);
        }
        static void ABC153_F()
        {
            var nda = ReadIntN();
            var N = nda[0];
            var D = nda[1];
            var A = nda[2];
            var xh = ReadTupleLong(N).OrderBy(x => x.Item1).ToArray();
            var h = xh.Select(x => x.Item2).ToArray();
            long sum = 0;
            for(int i = 0; i < N; ++i)
            {
                var bomb = (Math.Max(0, h[i]) + A - 1) / A;
                sum += bomb;
                if (bomb >= 0)
                {
                    for (int j = i; j < N; ++j)
                    {
                        if (xh[j].Item1 - xh[i].Item1 <= D * 2)
                        {
                            h[j] -= bomb * A;
                        }
                        else { break; }
                    }
                }
            }
            Console.WriteLine(sum);
        }

        static string ReadStr()
        {
            return Console.ReadLine();
        }
        static string[] ReadStrN()
        {
            return Console.ReadLine().Split(' ');
        }
        static int ReadInt()
        {
            return Convert.ToInt32(Console.ReadLine());
        }
        static int[] ReadIntN()
        {
            return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
        }
        static long ReadLong()
        {
            return Convert.ToInt64(Console.ReadLine());
        }
        static long[] ReadLongN()
        {
            return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();
        }
        static Tuple<long, long>[]  ReadTupleLong(int n)
        {
            List<Tuple<long, long>> list = new List<Tuple<long, long>>();
            for (int i = 0; i < n; ++i)
            {
                var ab = ReadLongN();
                list.Add(new Tuple<long, long>(ab[0], ab[1]));
            }
            return list.ToArray();
        }
    }
}


Measured memory_bytes: 41064