#include using namespace std; const int N = 114514; long long a[N], n, k; int check(long long x) { long long now = 0, cnt = 0; for(int i = 1; i <= n; i++) { if(a[i] + now < x) { long long m = (x - (a[i] + now) + i - 1) / i; cnt += m; now += m * i; } } return cnt <= k; } int main() { cin >> n >> k; for(int i = 1; i <= n; i++) { cin >> a[i]; } long long l = 0, r = 1145141919810114514; while(l < r) { long long mid = (l + r) / 2; if(check(mid + 1)) { l = mid + 1; } else { r = mid; } } cout << l; return 0; }