# 最低値の目標まで何回で到達できるか、二分探索、でどうか N, K = map(int, input().split()) A = list(map(int, input().split())) #X = 5 from math import ceil def check(X): count = 0 added = 0 for i in range(N): num = A[i] if num + added < X: subcount = ceil((X-num-added)/(i+1)) count += subcount added += (i+1)*subcount #print(count) if count <= K: return 1 else: return 0 #for x in range(20): # print(x, check(x)) OK = 0 NG = 10**20 while NG-OK>1: mid = (OK+NG)//2 if check(mid) == 1: OK = mid else: NG = mid print(OK)