n, m = map(int, input().split()) A = list(map(int, input().split())) def is_ok(x): y = 0 for a in A: y += a-m*x if y < 0: return False return True ok = 0 ng = 10**9+50 while ok +1 < ng: c = (ok+ng)//2 if is_ok(c): ok = c else: ng = c print(ok)