#include using namespace std; using ll = long long; const int MAXN = 100001; int n, k; ll a[MAXN]; bool check(ll x) { ll sum = 0, cnt = 0; for(int i = 1; i <= n; ++i) { if(a[i] + sum < x) { ll res = 1ll * (x - a[i] - sum + i - 1ll) / i; cnt += res, sum += res * i; } if(cnt > k) { return 0; } } return 1; } ll two_bound() { ll l = 0ll, r = 200000000000001ll; while(l < r) { ll mid = (l + r + 1ll) >> 1ll; if(check(mid)) { l = mid; }else { r = mid - 1; } } return l; } int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n >> k; for(int i = 1; i <= n; ++i) { cin >> a[i]; } cout << two_bound(); return 0; }