#include using namespace std; using ll = long long; int main() { ll n, k; cin >> n >> k; vector a(n); for(ll i = 0; i < n; i++) cin >> a[i]; ll ok = 0; ll ng = 1000000000000000; ll mid; ll ck, cnt; while(abs(ok - ng) != 1) { mid = (ok + ng) / 2; ck = k; cnt = 0; for(ll i = 0; i < n; i++) { if(mid <= cnt + a[i]) continue; ck -= (mid - cnt - a[i] + i) / (i + 1); cnt += (i + 1) * ((mid - cnt - a[i] + i) / (i + 1)); } if(ck < 0) ng = mid; else ok = mid; } cout << ok << endl; return 0; }