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