#include using namespace std; using LL = long long; const int MAXN = 1e5 + 3; int n; LL k, a[MAXN]; bool as(LL MIN){ LL _k = k; for(LL i = 1, s = 0; i <= n; i++){ if(a[i] + s < MIN){ LL cnt = (MIN - (a[i] + s) + i - 1) / i; _k -= cnt; if(_k < 0) return 0; s += cnt * i; } } return 1; } int main(){ cin >> n>> k; for(int i = 1; i <= n; i++){ cin >> a[i]; } LL l = 0, r = 1e17; while(l < r){ LL mid = (l + r + 1) >> 1; if(as(mid)){ l = mid; }else{ r = mid - 1; } } cout << l; return 0; }