#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

//#pragma GCC Optimize("O3")
//#pragma GCC Optimize("unroll-loops")
//#pragma GCC target("avx,avx2,bmi")

//using namespace __gnu_pbds;
using namespace std;

//template <class T> using ordered_set = tree<T, null_type, less<T> ,rb_tree_tag,tree_order_statistics_node_update>;
//struct h{
//    size_t operator ()(const pair<int,int>& a) const{
//        return ((size_t)a.first << 32) + a.second;
//    }
//};
void solve();

int main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    //cin>>t;
    while (t--) {
        solve();
    }
    return 0;
}

#define int long long
#define endl '\n'
const int INF = 2e18;
const int MAXN = 2e5;
const int MOD = 1e9 + 7;



void solve() {
    int n,k;
    cin >> n >> k;
    int ans = -INF;
    vector<int> a(n);
    int aa = 0;
    set<int>st;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (i < n-1) {
            st.insert(a[i]);
        } else {
            aa+=a[i];
        }
    }
    while (k > 1) {
        aa += *(--st.end());
        st.erase(--st.end());
        k--;
    }
    cout << aa + n;
}
