#include using namespace std; const int N = 114514; long long a[N], n, k; int ck(long long x) { long long now = 0, cnt = 0, tmp; for(int i = 1; i <= n; i++) { if(a[i] + now < x) { tmp = (x - (a[i] + now) + i - 1) / i; cnt += tmp; now += tmp * 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(ck(mid + 1)) { l = mid + 1; } else { r = mid; } } cout << l; return 0; }