import itertools n,m = map(int,input().split()) a = list(map(int,input().split())) s = list(itertools.accumulate(a)) ans = s[0] // m for i in range(1,n): ans = min(ans, s[i] // (m * (i+1))) print(ans)