N,M=map(int,input().split()) A=list(map(int,input().split())) sm=0 mn=10**18 for i in range(N): sm+=A[i] mn=min(mn,sm//(i+1)) print(mn//M)