N,M = map(int,input().split()) A = list(map(int,input().split())) ans = float("inf") now = 0 for i in range(N): now += A[i] ans = min(ans , now // (M*(i+1))) print (ans)