func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class T>   bool chmax(T &a, const T &b) {     if (a < b) {       a = b;       return 1;     }     return 0;   }   template <class T>   bool chmin(T &a, const T &b) {     if (b < a) {       a = b;       return 1;     }     return 0;   }   signed main() {     cin.tie(0);     ios::sync_with_stdio(false);     long long N, K;     cin >> N >> K;     vector<long long> A(N), sum(N + 1, 0);     long long ans = 0;     for (long long i = 0; i < N; i++) {       cin >> A[i];       ans += A[i];       sum[i + 1] += sum[i] + A[i];     }     vector<long long> tmp;     for (long long i = (1); i <= (N - 1); ++i) {       tmp.push_back(sum[N] - sum[i]);     }     sort((tmp).rbegin(), (tmp).rend());     for (long long i = 0; i < K - 1; i++) ans += tmp[i];     cout << ans << endl;     return 0;   }   