#include using namespace std; using ll = unsigned long long; const int maxn = 1e5 + 5; ll n, k, ma = 1e18, a[maxn], b[maxn]; bool check(ll x){ for(int i = 1; i <= n; i++){ b[i] = (x > a[i] ? x - a[i] : ll(0)); } ll c = 0, s = 0; for(int i = 1; i <= n; i++){ if(b[i] > s){ c += (b[i] - s + i - 1) / i; s += (b[i] - s + i - 1) / i * i; } } return c <= k; } int main(){ cin >> n >> k; for(int i = 1; i <= n; i++){ cin >> a[i]; ma = min(ma, a[i]); } ll l = 0, r = n * k + ma; while(l < r){ ll mid = (l + r + 1) / 2; if(check(mid)){ l = mid; } else { r = mid - 1; } } cout << l; return 0; } //