n,c=map(int,input().split()) a=list(map(int,input().split())) ok=0 ng=10**10 while ng-ok>1: m=(ok+ng)//2 b=a.copy() for i in reversed(range(1,n)): t=max(m*c-b[i],0) b[i]+=t b[i-1]-=t if b[0]>=m*c: ok=m else: ng=m print(ok)