#include //#include #define elif else if #define ll long long #define vll vector #define vec vector #define embk emplace_back #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep3(i, n, k) for (int i = k; i < (int)(n); i++) #define all(a) a.begin(), a.end() using namespace std; //using namespace atcoder; const ll INF = 1LL << 60; const ll mod = 998244353; void printvec(vector a, ll b) { for (int i = 0; i <= b; i++) { cout << a[i]; if (i == b) cout << endl; else cout << ' '; } } int main() { ll n, wl; cin >> n >> wl; vll w(n), v(n); rep(i, n) cin >> w[i] >> v[i]; vec dp(n+1, vll(200000, 0)); //dp[品目][重さ] = 価値 dp[0][0] = 0; rep(i, n) { rep(j, wl) { dp[i+1][j] = max(dp[i][j], dp[i+1][j]); dp[i+1][j+w[i]] = max(dp[i][j]+v[i], dp[i+1][j+w[i]]); } } rep3(i, wl+1, 1) { cout << dp[n][wl] - dp[n][wl-i] + 1 << endl; } //rep(i, n+1) printvec(dp[i], wl); }