#include using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long N, K; cin >> N >> K; vector A(N); for (long long &i : A) cin >> i; auto check = [&](long long x) -> bool { long long offset = 0, operations = 0; for (long long i = 0; i < N && operations <= K; ++i) { if (A[i] + offset < x) { operations += (x - A[i] - offset + i) / (i + 1); offset += (x - A[i] - offset + i) / (i + 1) * (i + 1); } } return operations <= K; }; long long L = 1, R = 1e15, ans = 0; while (R >= L) { long long M = L + R >> 1; if (check(M) == true) { ans = M; L = M + 1; } else { R = M - 1; } } cout << ans << endl; }