#include using namespace std; const int MAXN = 1e5 + 10; unsigned long long n, k, a[MAXN], mins = 1e18, b[MAXN]; bool F(unsigned long long x){ for(int i = 1; i <= n; i++){ if(a[i] < x){ b[i] = x - a[i]; } else { b[i] = 0; } } unsigned 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]); } unsigned long long l = 0, r = mins + k * n; while(l < r){ unsigned long long mid = (l + r + 1) >> 1; if(F(mid)){ l = mid; } else { r = mid - 1; } } cout << l; return 0; }