#include using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, k; std::cin >> n >> k; std::vector a(n); for (int i = 0; i < n; i++) { std::cin >> a[i]; } i64 lo = 0, hi = 2E14; while (lo < hi) { i64 x = (lo + hi + 1) / 2; i64 need = 0; i64 add = 0; for (int i = 0; i < n; i++) { i64 cur = a[i] + add; if (cur < x) { i64 t = (x - cur + i) / (i + 1); need += t; add += t * (i + 1); } } if (need <= k) { lo = x; } else { hi = x - 1; } } std::cout << lo << "\n"; return 0; }