N, M = map(int, input().split()) A = list(map(int, input().split())) def solve(k): ct = 0 for a in A: ct += a-k*M if ct < 0: return False else: return True ok, ng = 0, 10**9+1 while ng-ok > 1: m = (ng+ok)//2 if solve(m): ok = m else: ng = m print(ok)