using namespace std;

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

#define getBit(x,i) (x&(1<<i))
#define setBit(x,i) (x|(1<<i))
#define mem(A,N) memset(A,N,sizeof(A))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define mp make_pair
#define rep(i, x, y)  for(int i = x; i < y; ++i)
#define Rep(i, x, y)  for(int i = x; i <= y; ++i)
#define srep(i, x, y) for(int i = x; i > y; --i)
#define sRep(i, x, y) for(int i = x; i >= y; --i)
#define All(v) v.begin(),v.end()
#define sortA(a) sort(a, a+n)
#define sortArr(a, i, n) sort(a+i, a+n)
#define SortArr(a, i, n) sort(a+i, a+n+1)
#define Sort(x) sort(x.begin(), x.end())
#define sz(x) ((int)(x).size())
#define len(x) ((int)(x).length())
#define fi first
#define se second
#define concatenate(a, b) std::copy(b.begin(), b.end(), std::back_inserter(a));
#define fcout(x) cout << fixed << setprecision(x)
#define ifcout(x, a, b) if(x) cout << a << '\n'; else cout << b << '\n'
#define makeUnique(v) v.erase(unique(v.begin(), v.end()), v.end())
#define inRange(x, a, b) (a <= x && x < b)
#define min3(a01, b02, c03) (min(min(a01, b02), c03))

#define llInf 2'000'000'000'000'000'001LL
#define inf 1'000'000'001
#define ninf -1'000'000'001
#define nllInf -2'000'000'000'000'000'001LL
ll mod = 1000000007ll;
#define eps 1e-9
#define Pi 3.14159265358979323846

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define write(x) cerr << #x << " = " << (x) << ", ";
#define dump2(x1, x2)  cerr << #x1 << " = " << x1 << ", " << #x2 << " = " << x2 << endl;
#define dump3(x1, x2, x3)  cerr << #x1 << " = " << x1 << ", " << #x2 << " = " << x2 << ", " << #x3 << " = " << x3 << endl;
#define dump4(x1, x2, x3, x4)  cerr << #x1 << " = " << x1 << ", " << #x2 << " = " << x2 << ", " << #x3 << " = " << x3 << ", " << #x4 << " = " << x4 << endl;
#define write(x) cerr << #x << " = " << (x) << ", ";
#define writeI0 cerr << "i = " << 0 << ", ";
#define dumpI0 cerr << "i = " << 0 << endl;
#define printSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printMap(m) for(auto it = m.begin(); it!=m.end(); it++) (it==m.begin())? cout << '(' << it->first << ", " << it->second << ')' : cout << " (" << it->first << ", " << it->second << ')'; cout << endl;
#define printPairSet(s) for(auto it = s.begin(); it!=s.end(); it++) (it==s.begin())? cout << '(' << it->first << ", " << it->second << ')' : cout << " (" << it->first << ", " << it->second << ')'; cout << endl;
#define writeVector(x) for(auto it = x.begin(); it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it;
#define writeVectorS(x) for(auto it = x.begin(); it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it; cout << ", "
#define printVector(x) for(auto it = x.begin(); it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printVectorF(x) cout << *x.begin() << ": "; for(auto it = x.begin() + 1; it!=x.end(); it++) (it==x.begin())? cout << *it : cout << ' ' << *it; cout << endl;
#define printArray(a,x,y) for(auto it = a+x; it != a+y; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;
#define PrintArray(a,x,y) for(auto it = a+x; it != a+y+1; it++) (it==a+x)? cout << *it : cout << ' ' << *it; cout << endl;

// ***************** End Of Template ********************

struct matrix {
	int rows, cols;
    ll **a;
	
	matrix(): rows(2), cols(2) {
		a = new ll*[rows];
        for(int i = 0; i < rows; i++) {
            a[i] = new ll[cols];
            for(int j = 0; j < cols; j++)
                a[i][j] = 0;
        }
	}

	matrix(int rows, int cols): rows(rows), cols(cols) {
		a = new ll*[rows];
        for(int i = 0; i < rows; i++) {
            a[i] = new ll[cols];
            for(int j = 0; j < cols; j++)
                a[i][j] = 0;
        }
	}

	void initFib() {
		a[0][0] = 0; a[0][1] = 1;
		a[1][0] = 1; a[1][1] = 1;
	}

	matrix operator * (matrix& B) {
		matrix C (rows, B.cols);
        for (int i = 0; i < rows; ++i)
            for (int j = 0; j < B.cols; ++j)
                for (int k = 0; k < cols; ++k)
                    C.a[i][j] = (C.a[i][j] + a[i][k] * B.a[k][j]) % mod;
		return C;
	}
};

matrix createMatrix(int rows, int cols) {
    matrix M; M.rows = rows; M.cols = cols;
    M.a = new ll*[rows];
    for(int i = 0; i < rows; i++)
        M.a[i] = new ll[cols];
    return M;
}

matrix identity(int rowsCols) {
    matrix I = matrix(rowsCols, rowsCols);
    for(int i = 0; i < rowsCols; i++) I.a[i][i] = 1;
    return I;
}

// O(log(Exponent))
matrix pow(matrix &base, ll exponent) {
	if (exponent == 0) return identity(base.rows);

	matrix result = pow(base, exponent / 2);
	result = result * result;
	if (exponent & 1) result = base * result;

	return result;
}

ll pow2(matrix &base, ll exponent) {
    return pow(base, exponent).a[0][1];
}

ll n, m;
ll nn, mm;
// vi a;
// ll f() {
// 	if(a.size() == nn) 
// 		return 1LL;
	
// 	ll sol = 0LL;
// 	Rep(i, 1, mm) {
// 		if(a.size() <= 1 || a.back() != i || a[a.size() - 2] != i || a.back() != a[a.size() - 2]) {
// 			a.pb(i);
// 			sol += f();
// 			a.pop_back();
// 		}
// 	}
// 	return sol;
// }

long long modPow(long long b, long long e) {
    long long r = 1;
    while(e > 0) {
        if( e & 1) {
            r = r * b % mod;
        }
        b = b * b % mod;
        e /= 2;
    }
    return r;
}

// long long modInverse(long long a) {
// 	a %= mod;
//     return modPow(a, mod-2);
// }

void Testcase()
{
   int a,rem,b;
   cin>>a>>b;
   if(a>=b){
   rem=a%b;
   if(rem>0)
   cout<<(a/b)+1<<endl;
   else
   cout<<(a/b)<<endl;}
   else
   cout<<1<<endl;
}

void Testcase1()
{
   long long int n,k;
   cin>>n>>k;
   vector<long long int>v(n);
   rep(i,0,n)
   cin>>v[i];
   if(k>=n)
   cout<<0<<endl;
   else{
       long long int s=0;
       Sort(v);
       rep(i,0,n-k)
       s+=v[i];
       cout<<s<<endl;
   }
    
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	
	//Testcase();
	Testcase1();
	
	return 0;
}

Measured memory_bytes: 1792