#include <bits/stdc++.h>
using namespace std;
#define int long long
const long long INF = 1e18, MOD = 1e9 + 7;

void solve();

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