#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#define all(v) v.begin(), v.end()
#define fi first
#define se second

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<long long, long long> pii;

struct SegTree {
	ll n;
	vector<ll> a, t, ot;
	SegTree(vector<ll> _a) {
		a = _a;
		n = a.size();
		t.resize(4 * n);
		ot.resize(4 * n);
		build(1, 0, n);
	}
	void update(ll v) {
		t[v] = t[2 * v] + t[2 * v + 1];
	}
	void build(ll v, ll l, ll r) {
		if (r - l == 1) {
			t[v] = a[l];
			return;
		}
		ll m = (l + r) / 2, vl = 2 * v, vr = vl + 1;
		build(vl, l, m);
		build(vr, m, r);
		update(v);
	}
	void push(ll v, ll l, ll r) {
		if (ot[v]) {
			t[v] += (r - l) * ot[v];
			if (r - l > 1) {
				ot[2 * v] += ot[v];
				ot[2 * v + 1] += ot[v];
				return;
			}
			ot[v] = 0;
		}
	}
	ll get(ll v, ll l, ll r, ll al, ll ar) {
		push(v, l, r);
		if (l >= ar || r <= al) return 0;
		if (l >= al && r <= ar) return t[v];
		ll m = (l + r) / 2, vl = 2 * v, vr = vl + 1;
		return get(vl, l, m, al, ar) + get(vr, m, r, al, ar);
	}
	void add(ll v, ll l, ll r, ll al, ll ar, ll x) {
		push(v, l, r);
		if (l >= ar || r <= al) return;
		if (l >= al && r <= ar) {
			ot[v] += x;
			push(v, l, r);
			return;
		}
		ll m = (l + r) / 2, vl = 2 * v, vr = vl + 1;
		add(vl, l, m, al, ar, x);
		add(vr, m, r, al, ar, x);
		update(v);
		return;
	}
};

struct Point {
	ll x, y;
};

istream& operator >> (istream& in, Point& p) {
	in >> p.x >> p.y;
	return in;
}

ostream& operator << (ostream& out, Point& p) {
	out << p.x << ' ' << p.y << '\n';
	return out;
}

void solve() {
	ll n, k;
	cin >> n >> k;
	vector<ll> a(n);
	for (ll i = 0; i < n; i++) cin >> a[i];
	set<ll> se;
	for (ll i = 0; i < n - 1; i++) {
		se.insert(a[i]);
	}
	ll ans = a[n - 1];
	ll cnt = 0;
	for (ll i = 1; i < k; i++) {
		auto it = se.end();
		it--;
		//cout << *it << '\n';
		ans += *it;
		se.erase(it);
	}
	cnt += n;
	cout << ans + cnt << '\n';
}

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