N, K = gets.split.map(&:to_i) A = gets.split.map(&:to_i) ac = 0 wa = 10**20 while wa - ac > 1 wj = (ac + wa) >> 1 add = 0 count = 0 N.times do |i| if A[i] + add < wj c = (wj - (A[i] + add) + i) / (i + 1) count += c add += c * (i + 1) end end if count <= K ac = wj else wa = wj end end puts ac