N,K = map(int,input().split()) A = list(map(int,input().split())) end = 10 ** 15 start = 0 def calc(mid): n = 0 now = 0 for i in range(N): a = A[i] if a + now < mid: u = (mid - a - now + i) // (i + 1) n += u now += u * (i + 1) if n > K:return False return True while end - start > 1: mid = end + start >> 1 if not calc(mid): end = mid else: start = mid print(start)