#ifdef LOCAL
#include ".debug.hpp"
#else
#define debug(...) 42
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
signed main() {
#ifndef VOID
cin.tie(nullptr)->sync_with_stdio(false);
#endif
int N, K; cin >> N >> K;
vector<int64_t> A(N + 1); for (int i = 1; i <= N; i++) cin >> A[i];
vector<int64_t> res;
for (int i = 2; i <= N; i++) res.push_back(A[i] - A[i - 1]);
sort(res.rbegin(), res.rend()); K--;
int64_t ans = A[N] - A[1] + 1;
for (int i = 0; i < K; i++) ans -= res[i];
cout << ans + K << '\n';
return 0;
}