#include using namespace std; using ll = long long; bool func(vector& a, int n, ll m, ll mid){ ll s = 0; ll t = mid * m; for(int i = 0; i < n; ++i){ s += a[i]; if(s < t * (i + 1)){ return false; } } return true; } int main(){ int n; ll m; cin >> n >> m; vector a(n); for(auto& x : a){ cin >> x; } ll ok = 0; ll ng = 1000000001; while(abs(ok - ng) > 1){ ll mid = (ok + ng) / 2; if(func(a, n, m, mid)){ ok = mid; } else{ ng = mid; } } cout << ok << endl; return 0; }