import itertools n,m = map(int,input().split()) a = list(map(int,input().split())) s = list(itertools.accumulate(a)) def func(k): t = m * k res = True for i in s: if(i < t): res = False break t += m * k return res ok = 0 ng = 10**9+1 while(ng-ok > 1): k = (ok+ng)//2 if(func(k)): ok = k else: ng = k print(ok)