#include #include #define rep(i, l, n) for (int i = (l); i < (n); i++) using namespace std; using ll = long long; template using V = vector; bool func(V&a, ll n, ll m, ll k) { ll s = 0; ll t = m * k; bool res = true; rep(i, 0, n) { s += a[i]; if (s < t) { res = false; break; } t += m * k; } return res; } int main(void) { ll n, m; cin >> n >> m; V a(n); rep(i, 0, n) { cin >> a[i]; } ll ok = 0; ll ng = 1000000001; while (ng - ok > 1) { ll k = (ok + ng) / 2; if (func(a, n, m, k)) { ok = k; } else { ng = k; } } cout << ok << '\n' << endl; return 0; }