#include <cstdio>
#include <iostream>
#include <set>
#include <vector>

using namespace std;


int main () {
  freopen("A.in","r",stdin);
  freopen("A.out","w",stdout);
     
int drug,n;
vector<int> vec;
int rem = 0;

cin>>n>>drug;

int a[n];
 
multiset<int> temp;

for(int i=0;i<n;i++)

       { cin >> a[i]; 


     
        temp.insert(a[i]);    }

multiset<int> :: iterator it;

int k=n - 1;
for (it = temp.begin(); it != temp.end(); it++) 

{   vec.push_back( ( *it) );    } 

int z=vec.size();
while(z > drug){ 
 rem = rem + vec[k];
 z--;
 k--; 
    } 
  
 cout<<rem;     
      
      return 0;
 }