n,k=map(int,input().split()) a=list(map(int,input().split())) def cal(x): cnt = 0 now = 0 for i in range(n): if now + a[i] < x: t=now + a[i] v,m=divmod(x-t,i+1) if m>0: v+=1 cnt += v now += v * (i+1) # print(cnt,x) if cnt <= k: return True else: return False ok = 0 ng = 10 ** 15 while ng - ok > 1: mid = (ng+ok)//2 if cal(mid): ok = mid else: ng = mid print(ok)