func_code_string: #include <bits/stdc++.h>   using namespace std;   const int N = 200005;   int n, m;   long long ans, a[N], b[N];   char c;   long long read() {     long long x = 0;     int sig = 1;     for (c = getchar(); c <  0  || c >  9 ; c = getchar())       if (c ==  - ) sig = -1;     for (; c >=  0  && c <=  9 ; c = getchar()) x = x * 10 + c - 48;     return x * sig;   }   long long calc(int p) {     b[n] = min(a[n], (long long)m * p - (long long)p * (p - 1) / 2 * n);     for (int i = n - 1; i; i--) b[i] = min(a[i], b[i + 1] - p);     if (b[1] < p + (long long)p * (p - 1) / 2 * n) return 0;     long long sum = 0,               s = max(1ll, b[1] - (long long)(m + 1) * (p - 1) +                                (long long)p * (p - 1) / 2 * n),               Buy;     sum = Buy = b[1];     int Free = m - n * p - s + 1;     for (int i = 2; i <= n; i++) {       Buy += p;       int Shift = min(b[i] - Buy, (long long)Free);       Free -= Shift;       Buy += Shift;       sum += Buy;     }     return sum;   }   int main() {     n = read();     m = read();     for (int i = 1; i <= n; i++) a[i] = read();     ans = 0;     for (int i = 1; i * n <= m; i++) ans = max(ans, calc(i));     printf( %I64d n , ans);     return 0;   }   