#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#include <map>
#include <unordered_map>
#include <random>
#include <chrono>
// #include <bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock().now().time_since_epoch().count());

using ll = long long;
using ld = long double;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    vector <ll> a(n);
    for (int i=0; i < n; ++i) {
        cin >> a[i];
    }
    ll ans = n + a.back();
    a.pop_back();
    sort(a.begin(), a.end());
    for (int i=0; i < k - 1; ++i) {
        ans += a[n - 2 - i];
    }
    cout << ans << "\n";
    return 0;
}
