#include <bits/stdc++.h>

using namespace std;

#define int long long

signed main() {
    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;
    }int sum = a.back().first + n;
    sort(a.begin(), a.end());
    int h = 0;
    for (int i = n - 1; i > n - k - h; i--) {
        if ((a[i].second != n - 1)) sum += a[i].first;
        h = max(h, (int) (a[i].second == n - 1));
    }
    cout << sum;
//    int cur = a.back() + 1;
//    int cnt = 0;
//    int sum = n;
//    for (int i = n - 2; i > -1; i--) {
//        cur++;
//        if (a[i] > cur) {
//            cnt++;
//            cur = a[i] + 1;
//        }
//    }
//    cout << cnt;
}
