func_code_string: #include <bits/stdc++.h>   using namespace std;   int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1};   int dy[8] = {0, 0, -1, 1, 1, -1, -1, 1};   int n, k, f;   vector<int> v;   int main(void) {     scanf( %d%d , &n, &k);     for (int i = 0; i < n; i++) {       scanf( %d , &f);       v.push_back(f);     }     long long ans = 0;     sort(v.rbegin(), v.rend());     int to = 0;     for (int i = 0; i < v.size(); i++) {       to++;       if (to == k || i + 1 == v.size()) {         ans += 2 * (v[i - to + 1] - 1);         to = 0;       }     }     cout << ans << endl;     return 0;   }   