func_code_string: #include <bits/stdc++.h>   using namespace std;   const int mod = 1e9 + 7;   long long gcd(long long x, long long y) { return y == 0 ? x : gcd(y, x % y); }   long long logg(long long x, long long y) {     if (x == 0) return -1;     return logg(x / y, y) + 1;   }   long long poww(long long a, long long b, long long m) {     if (b == 0) return 1;     long long ans = 1;     ans = poww(a, b >> 1, m);     ans = (ans * ans) % m;     if (b & 1) ans = (ans * a) % m;     return ans;   }   int32_t main() {     ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);     long long n, k;     cin >> n >> k;     long long a[n], b[n];     for (long long i = 0; i < n; i++) cin >> a[i], b[i] = a[i];     sort(b, b + n, greater<long long>());     long long sum = 0;     map<long long, long long> mp;     for (long long i = 0; i < k; i++) sum += b[i], mp[b[i]]++;     long long count = 0;     vector<long long> ans;     for (long long i = 0; i < n; i++) {       if (k == 1) {         ans.push_back(n - i);         break;       }       if (mp.count(a[i]))         count++, ans.push_back(count), count = 0, mp[a[i]]--, k--;       else         count++;       if (mp[a[i]] == 0) mp.erase(a[i]);     }     cout << sum <<   n ;     for (auto i : ans) cout << i <<    ;   }   