# 二分探索してみるか? # 毎回の判定に時間がかかりすぎる気がする def check(x): add = 0 add_cum = 0 for i in range(1, N+1): if A[i-1]+add_cum < x: calc = (x-A[i-1]-add_cum+(i-1))//i add += calc add_cum += calc*i if add <= K: return 1 else: return 0 N, K = map(int, input().split()) A = list(map(int, input().split())) #for x in range(0, 10): # print(x, check(x)) OK = -1 NG = 10**20 while (NG-OK)>1: mid = (NG+OK)//2 if check(mid) == 1: OK = mid else: NG = mid print(OK)