#include #define int __int128 using namespace std; const int MAXN = 1e5 + 5; int n, k, a[MAXN], minn = 1e22, b[MAXN]; int read(){ string s; cin >> s; int cnt = 0; for (int i = 0; i < s.size(); i++){ cnt = cnt * 10 + s[i] - '0'; } return cnt; } void print(int x){ if (x < 10){ signed p = x; cout << p; return ; } print(x / 10); signed p = x % 10; cout << p; } bool check(int x){ int p = 0, q = 0; for (int i = 1; i <= n; i++){ b[i] = max(int(0), x - a[i]); } for (int i = 1; i <= n; i++){ if (b[i] > q){ p += (b[i] - q + i - 1) / i; q += (b[i] - q + i - 1) / i * i; } } return p <= k; } signed main(){ ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); n = read(), k = read(); for (int i = 1; i <= n; i++){ a[i] = read(); } int l = 0, r = 1e20; while (l < r){ int mid = (l + r + 1) >> 1; if (check(mid)){ l = mid; }else { r = mid - 1; } } print(l); return 0; }