#include<stdio.h>
#include<iostream>
using namespace std;
int a[200000]={0};
int main(){
	freopen("A.in","r",stdin);
	freopen("A.out","w",stdout);
		int n,m,k,l;
		__int64 ans=0;
		cin>>n>>m;
		for (int i=0;i<n;i++) {
			cin>>k;
			a[k]++;
		}
		l=n-m;
		for (int i=100000;i>0;i--)
		{
			for (int j=0;j<a[i];j++) {
				if (l>0) {l--; ans+=i;}
			}
		}
	cout<<ans;
	return 0;
}