import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import permutations from math import gcd,log input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) N,K = mi() A = li() def cond(x): add = 0 res = 0 for i in range(N): if A[i]+add < x: need = (x-A[i]-add+i)//(i+1) res += need add += need * (i+1) return res <= K ok = 0 ng = 10**17 while ng-ok>1: mid = (ok+ng)//2 if cond(mid): ok = mid else: ng = mid print(ok)