n, k = map(int, input().split()) a = list(map(int, input().split())) ok = min(a) ng = 1 << 60 while abs(ok - ng) > 1: mid = (ok + ng) // 2 offset = 0 cnt = 0 for i in range(n): cost = max(0, (mid - a[i] - offset + i) // (i + 1)) cnt += cost offset += cost * (i + 1) if cnt <= k: ok = mid else: ng = mid print(ok)