import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd n,k = map(int,input().split()) a =[0] + list(map(int,input().split())) l = 0 r = 10**18 while r-l > 1: m = (r+l)//2 cnt = 0 now = 0 for i in range(1, n+1): if a[i] + now < m: dif = m - (a[i] + now) tmp = (dif+i-1)//i cnt += tmp now += tmp * i if cnt <= k: l = m else: r = m print(l)