#include using namespace std; using ll=long long; using ull=unsigned long long; using pii=pair; #define INF LONG_MAX #define MOD1 1000000007 #define MOD2 998244353 #define MOD MOD1 #define rng(a) a.begin(),a.end() #define rrng(a) a.end(),a.begin() #define endl "\n" int main(){ ios::sync_with_stdio(false); cin.tie(0); int N,M; cin>>N>>M; vectorA(N); for(int i=0;i>A[i]; int l=0; int r=1000000; int m; while(r-l>1){ m=(r+l)/2; bool ok=true; int d=0; for(int i=0;i=M*m){ d-=M*m-A[i]; } else{ ok=false; break; } } else{ d+=A[i]-M*m; } } if(ok)l=m; else r=m; } cout<