#include using namespace std; using ll = long long; template T UpperBound(T i0, T i1, F f) { while (i0 < i1) { T i = i0 + (i1 - i0) / 2; if (f(i)) i0 = i + 1; else i1 = i; } return i0; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } auto x = UpperBound(1, (ll)3e14, [&](auto x) { ll s = k; for (int i = 0; i < n; i++) { ll t = x - a[i]; if (t <= 0) continue; t = (t + i) / (i + 1); s -= t; x -= t * (i + 1); if (s < 0) return false; } return true; }) - 1; cout << x << endl; return 0; }