#include using namespace std; const int MAXN = 1e5 + 10; long long n, k, a[MAXN], mins = 1e18, b[MAXN]; bool F(long long x){ for(int i = 1; i <= n; i++){ if(a[i] < x){ b[i] = x - a[i]; } else { b[i] = 0; } } long long xx = 0, s = 0; for(int i = 1; i <= n; i++){ if(b[i]){ b[i] -= s; if(b[i]){ xx += (b[i] + i - 1) / i; s += (b[i] + i - 1) / i * i; } } } return xx <= k; } int main(){ cin >> n >> k; for(int i = 1; i <= n; i++){ cin >> a[i]; mins = min(mins, a[i]); } long long l = 0, r = mins + k * n; while(l < r){ long long mid = (l + r + 1) >> 1; if(F(mid)){ l = mid; } else { r = mid - 1; } } cout << l; return 0; }