#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> A(n);
    for (int i = 0; i < n; ++i)
        cin >> A[i];
    long long sum;
    sum = 0;
    for (int i = 0; i < k; ++i) {
        sum += A[n - k - 1];
    }
    sum += n - k;
    cout << sum << endl;
    return 0;
}
