#yuki1808 n,m=map(int,input().split()) a=list(map(int,input().split())) res=a[0] s=0 for i in range(n): s+=a[i] res=min(res,s//(i+1)//m) print(res)