//TLE解法 #include using namespace std; using ll = long long; #define all(A) A.begin(),A.end() using vll = vector; #define rep(i, n) for (long long i = 0; i < (long long)(n); i++) ll gcd(ll(a), ll(b)) { ll c = a; while (a % b != 0) { c = a % b; a = b; b = c; } return b; } vll DP(300005,1e18); ll dfs(ll n){ if(n==1){ DP[1]=0; return 0; } ll res=1e18; if(DP[n]<1e17)return DP[n]; for(ll i=1;i*i<=n;i++){ //cout<1e17)dfs(i); res=min(res,DP[i]+n/i); if(i!=1)if(DP[n/i]>1e17)dfs(n/i); res=min(res,DP[n/i]+i); } } DP[n]=res; return res; } int main() { ll N,M; cin>>N>>M; ll S=0; vll W(N); rep(i,N){ cin>>W[i]; S+=W[i]; } rep(i,N)cout<