#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>

using namespace std;

using ll = long long;

#pragma GCC optimaze("Ofast");

ll ans = 0;

void rec(vector<ll>& a, vector<int>& b, int i, int k) {
	int n = int(a.size());
	if (i == n) {
		vector<ll> ma(k), sz(k);
		for (int I = 0; I < n; I++) {
			sz[b[I]]++;
			ma[b[I]] = max(ma[b[I]], sz[b[I]] + a[I]);
		}
		ll su = 0;
		for (ll x : ma) su += x;
		ans = max(ans, su);
		return;
	}
	for (int x = 0; x < k; x++) {
		b.push_back(x);
		rec(a, b, i + 1, k);
		b.pop_back();
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n, k;
	cin >> n >> k;
	cout << "wtf";
	vector<ll> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	ll su = 0;
	for (int i = n - 1; i >= n - k; i++) su += a[i];
	cout << su + n;
}



