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

int main() {
    ll i,j,n,k,m,t;
    cin>>n>>k;
    vector<ll>a(n);
    for (i=0;i<n;i++){
        cin>>a[i];
    }
    ll s=0;
    for (i=0;i<k;i++){
        s+=a[n-i-1];
    }
    s+=n;
    cout<<s<<'\n';
    return 0;
}
