mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline N, M = map(int, input().split()) A = list(map(int, input().split())) ok = 0 ng = 10 ** 9 + 1 mid = (ok + ng) // 2 while ng - ok > 1: x = 0 flg = 1 for a in A: x += a - M * mid if x < 0: flg = 0 break if flg: ok = mid else: ng = mid mid = (ok + ng) // 2 print(ok) if __name__ == '__main__': main()