import sys input = sys.stdin.readline def judge(x): add = 0 need = 0 for i in range(N): lack = max(0, x-A[i]-add) c = (lack+i)//(i+1) need += c add += c*(i+1) return need<=K N, K = map(int, input().split()) A = list(map(int, input().split())) ok = -1 ng = 10**18 while abs(ok-ng)>1: mid = (ok+ng)//2 if judge(mid): ok = mid else: ng = mid print(ok)