#include #include using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.14159265359; ll inf=10000000000000001; ll mod=998244353; int main(){ ll n,w; cin >> n >> w; vectorww(n),v(n); for (ll i = 0; i < n; i++) { cin >> ww[i]>>v[i]; } vectordp(w+1,-1); dp[0]=0; for (ll i = 0; i < n; i++) { for (ll j = w-1; j >=0; j--) { if (dp[j]==-1) { continue; } if (j+ww[i]<=w) { dp[j+ww[i]]=max(dp[j+ww[i]],dp[j]+v[i]); } } } for (ll i = 1; i <=w; i++) { dp[i]=max(dp[i],dp[i-1]); } for (ll i = w-1; i >=0; i--) { cout << dp[w]-dp[i]+1 << endl; } }