#include<bits/stdc++.h>
using namespace std;
using ll = long long;




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