#include using namespace std; #define rep(i,n) for(int i=0;i<(int)(n);i++) #define ALL(v) v.begin(),v.end() typedef long long ll; template using V=vector; template using VV=V>; const int INF=1e3; const int MOD=998244353; const int geta=10000; pair dp[111][30303]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); rep(i,111) rep(j,30303) dp[i][j]={-INF,-INF}; ll n,w; cin>>n>>w; V V(n),W(n); rep(i,n) cin>>V[i]>>W[i]; dp[0][geta]={0,1}; rep(i,n){ rep(j,30303){ if(dp[i][j].first==-INF) continue; if(dp[i+1][j].first>dp[i][j].first) ; else if(dp[i+1][j].first=30303) continue; if(dp[i+1][j+W[i]].first>dp[i][j].first+V[i]) continue; else if(dp[i+1][j+W[i]].first