import sys input = sys.stdin.readline N,K = map(int,input().split()) A = list(map(int,input().split())) OK=0 NG=10**18 while NG>OK+1: mid=(OK+NG)//2 c=0 p=0 for i in range(N): if A[i]+c<mid: u=mid-A[i]-c x=i+1 k=(u+x-1)//x p+=k c+=k*x if p<=K: OK=mid else: NG=mid print(OK)