#include<bits/stdc++.h>

using namespace std;

using ll = long long;


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

