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

#define int long long

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int n, k;
vector<int> a;
vector<pair<int, int>> b;

struct dsu {
    vector<int> d;

    dsu() {
        d.resize(n);
        for (int i = 0; i < n; i++)
            d[i] = i;
    }

    int find(int u) {
        if (d[u] == u)
            return u;
        return d[u] = find(d[u]);
    }

    void merge(int u, int v) {
        u = find(u), v = find(v);
        d[u] = v;
    }
};

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> k;
    a.resize(n);
    for (auto &x: a) cin >> x;
    int res = a[n - 1];
    a.pop_back();
    sort(a.begin(), a.end());
    reverse(a.begin(), a.end());
    for (int i = 0; i < k - 1; i++)
        res += a[i];
    cout << res + n << '\n';
    return 0;
}
