import itertools n,m = map(int,input().split()) a = list(map(int,input().split())) s = list(itertools.accumulate(a)) if not(1 <= n <= 2 * 10 ** 5 and 1 <= m <= 10 ** 9): exit(1) if any(not(0 <= i <= 10 ** 9) for i in a): exit(1) ans = s[0] // m for i in range(1,n): ans = min(ans, s[i] // (m * (i+1))) print(ans)