#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include<stack>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>

using namespace std;
using ll = long long int;
using ld = long double;

void solve() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    vector<pair<ll, ll>> b(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = {a[i], i};
    }
    sort(b.rbegin(), b.rend());
    bool t = false;
    ll su = 0;
    for (int i = 0; i < k; ++i) {
        su += b[i].first;
        if (b[i].second == n - 1) {
            t = true;
        }
    }
    if (!t) {
        su += a[n - 1];
        su -= b[k - 1].first;
    }
    su += (ll)n;
    cout << su;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int tt = 1;
    while (tt--) {
        solve();
    }
}