func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 110005;   long long arr[maxn], arr1[maxn], n, m;   int judge(long long x) {     memcpy(arr1, arr, sizeof(arr));     long long i = n, countt = 1, t = 0;     while (i >= 1 && arr1[i] <= 0) --i;     while (countt <= m) {       t = x - i;       while (t > 0) {         if (t >= arr1[i]) {           t = t - arr1[i];           arr1[i] = 0;           i--;           if (i < 1) return 1;         } else {           arr1[i] = arr1[i] - t;           t = 0;         }       }       ++countt;     }     return 0;   }   long long aa(long long x) {     long long i = n, temp;     while (i >= 1 && arr[i] <= 0) --i;     temp = arr[i];     int countt = 1;     while (countt <= m) {       long long t = x - i;       while (t > 0) {         if (t >= temp) {           t -= temp;           i--;           while (i >= 1 && arr[i] <= 0) --i;           if (i < 1) return 1;           temp = arr[i];         } else {           temp -= t;           break;         }       }       countt++;     }     return 0;   }   int main() {     long long left, right, ans, mid;     scanf( %lld%lld , &n, &m);     left = 0;     right = 1e18;     ans = 0;     for (int i = 1; i <= n; i++) {       scanf( %lld , &arr[i]);     }     while (left <= right) {       mid = (left + right) / 2;       if (aa(mid)) {         ans = mid;         right = mid - 1;       } else {         left = mid + 1;       }     }     printf( %lld n , ans);     return 0;   }   