def main(): N, M = map(int, input().split()) A = list(map(int, input().split())) sum_ = A[0] for idx in range(1, N): if A[idx] <= sum_ // idx: sum_ += A[idx] else: try: A[idx+1] += A[idx] - sum_ // idx except IndexError: pass sum_ += sum_ // idx print((sum_ // idx)//M) if __name__ == "__main__": main()