#include #if __has_include() #endif using namespace std; #define eb emplace_back #define LL(...) ll __VA_ARGS__;lin(__VA_ARGS__) #define RDVV(T,n,...) vec__VA_ARGS__;fe(refs(__VA_ARGS__),e)e.get().resizes(n);vin(__VA_ARGS__) #define VV(n,...) RDVV(ll,n,__VA_ARGS__) #define fo(i,...) for(auto[i,i##stop,i##step]=for_range(0,__VA_ARGS__);ivoid pp(const auto&...a){[[maybe_unused]]const char*c="";((o<(a...);} #define entry defpp void main();void main2();}int main(){my::io();my::main();}namespace my{ namespace my{ void io(){cin.tie(nullptr)->sync_with_stdio(0);cout<constexpr auto for_range(T s,T b){T a=0;if(s)swap(a,b);return array{a-s,b,1-s*2};} templateconstexpr auto for_range(T s,T a,T b,T c=1){return array{a-s,b,(1-s*2)*c};} void lin(auto&...a){(cin>>...>>a);} void vin(auto&...a){fo(i,(a.size()&...))(cin>>...>>a[i]);} constexpr ll size10(auto x){x|=1;ll r=0;while(x>0)x/=10,++r;return r;} templateconstexpr ll maxsize10(){return size10(numeric_limits::max());} auto max(auto...a){return max(initializer_list>{a...});} templatestruct pair{ A a;B b; pair()=default; pair(A a,B b):a(a),b(b){} auto operator<=>(const pair&)const=default; }; templatestruct infinity{ templatestatic constexpr T ones(size_t n){return n?ones(n-1)*10+1:0;} templateconstexpr operator T()const{return ones(maxsize10())*(1-is_negative*2);} constexpr auto operator-()const{return infinity();} }; constexpr infinity oo; templateusing pack_back_t=tuple_element_t>; } namespace my{ templateconcept vectorial=is_base_of_v::value_type>,remove_cvref_t>; templateconstexpr int depth=0; templateconstexpr int depth =depth+1; templatestruct core_t_helper{using type=T;}; templatestruct core_t_helper{using type=typename core_t_helper::type;}; templateusing core_t=core_t_helper::type; templatestruct vec; templatestruct hvec_helper{using type=vec::type>;}; templatestruct hvec_helper<0,T>{using type=T;}; templateusing hvec=hvec_helper::type; templatestruct vec:vector{ static constexpr int D=depth+1; using C=core_t; using vector::vector; vec(const auto&...a)requires(sizeof...(a)>=3){resizes(a...);} void resizes(const auto&...a){if constexpr(sizeof...(a)==D)*this=make(a...,C{});else*this=make(a...);} static auto make(ll n,const auto&...a){ if constexpr(sizeof...(a)==1)return vec(n,array{a...}[0]); else return vec(n,make(a...)); } ll size()const{return vector::size();} vec&fill(C x){if constexpr(D>1){ }else std::fill(this->begin(),this->end(),x);return*this;} auto&emplace_back(auto&&...a){vector::emplace_back(std::forward(a)...);return*this;} templateauto fold(auto&&f)const{ pairres{}; fe(*this,e){ if constexpr(!vectorial){ if(res.b)f(res.a,e); else res={e,1}; }else { } } return res; } auto min()const{return fold([](auto&a,auto b){if(brequires(sizeof...(A)>=2)vec(const A&...a)->vec>>; } namespace my{ templateauto pow2_partition(ll n){vecr;for(ll k=1;k<=n;k<<=1)r.eb(k),n-=k;if(n)r.eb(n);return r;} } namespace my{ templatestruct max_node{ using S=T; static S op(S a,S b){return max(a,b);} static S e(){return-oo;} }; } namespace my{ templateauto knapsack_limitations_nonneg_enumerate(const vec&a,const vec&b,const vec&c,ll X){ assert(a.min()>=0); ll n=a.size(); vec dp(2,X+1,e()); dp[0][0]=0; fo(i,n){ fe(pow2_partition(c[i]),t){ dp[1].fill(e()); fo(j,X+1){ if(dp[0][j]==e())continue; dp[1][j]=op(dp[1][j],dp[0][j]); ll nj=j+a[i]*t; if(nj<=X)dp[1][nj]=op(dp[1][nj],dp[0][j]+b[i]*t); } swap(dp[0],dp[1]); } } return dp[0]; } templateauto knapsack_01_nonneg_enumerate(const vec&a,const vec&b,ll X){ return knapsack_limitations_nonneg_enumerate(a,b,vec(a.size(),1),X); } templateauto knapsack_01_nonneg_enumerate(const vec&a,const vec&b,ll X){ return knapsack_01_nonneg_enumerate(a,b,X); } } namespace my{entry void main(){ LL(N,M); VV(N,a,b); auto dp=knapsack_01_nonneg_enumerate>(a,b,M); dp=dp.scan(max); fo(X,1,M+1)pp(dp[M]-dp[M-X]+1); }}