#pragma GCC optimize("Ofast") #include using namespace std; typedef long long int ll; typedef unsigned long long int ull; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll myRand(ll B) { return (ull) rng() % B; } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n,W; cin >> n >> W; vector w(n),v(n); for (int i = 0; i < n; ++i) { cin >> w[i] >> v[i]; } vector dp(W+1); for (int i = 0; i < n; ++i) { for (int j = W; j >= w[i]; --j) { dp[j] = max(dp[j], dp[j-w[i]] + v[i]); } } for (int i = 1; i <= W; ++i) { dp[i] = max(dp[i], dp[i-1]); } for (int i = 1; i <= W; ++i) { cout << dp[W]-dp[W-i]+1 << "\n"; } }