## https://yukicoder.me/problems/no/2217 def solve(A, K, value): x = 0 for i in range(len(A)): a = A[i] if a + x >= value: continue y = value - (a + x) z = y // (i + 1) if y % (i + 1) != 0: z += 1 if K - z < 0: return False K -= z x += z * (i + 1) return True def main(): N, K = map(int, input().split()) A = list(map(int, input().split())) low = 0 high = 10 ** 16 while high - low > 1: mid = (high + low ) // 2 if solve(A, K, mid): low = mid else: high = mid if solve(A, K, high): print(high) else: print(low) if __name__ == "__main__": main()