#include "bits/stdc++.h"
using namespace std;
# define int long long
# define all(a) a.begin(), a.end()


signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifdef LOCAL
freopen("in.txt", "r", stdin);
freopen("out.txt", "w", stdout);
#endif
    int n, k;
    cin >> n >> k;
    vector<pair<int, int>> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(all(a), [&](pair<int, int> &x, pair<int, int> &y){
        if(x.second == n - 1) return  true;
        if(y.second == n - 1) return  false;
        return x.first > y.first || (x.first == y.first && x.second > y.second);
    });
    a.resize(k);
//    bool good = false;
//    for(auto &i : a){
//        if(i.second == n - 1){
//            good = true;
//            break;
//        }
//    }
        int sum = 0;
        for(auto &[i, j] : a){
            sum += i;
        }
        cout << sum + n;
    return 0;
}