N,K = map(int,input().split()) A = [-1] + list(map(int,input().split())) OK = 0 NG = 10**30 while NG - OK >= 2: MID = (OK + NG) // 2 count = 0 now_plus = 0 for i in range(1,N+1): if A[i] + now_plus < MID: k = -(-(MID - A[i] - now_plus) // i) count += k now_plus += i * k #print(MID,count) if count > K: NG = MID else: OK = MID print(OK)