#include<bits/stdc++.h>
using namespace std;
vectorv;
vectorw;
vector<vector>dp;
long long minwt(int n,int val){
if(dp[n][val]!=-1){
return dp[n][val];
}
long long mn = minwt(n-1,val);
if(val>=v[n]){
long long b = minwt(n-1,val-v[n])+w[n];
mn = min(mn,b);
}
return mn;
}
void solve(){
int n,wt;cin>>n>>wt;
v.resize(n);
w.resize(n);
int mxvl = n*1000+1;
dp.resize(n,vector<long long>(mxvl,-1));
for(int i=0;i<n;i++){
cin>>w[i]>>v[i];
}
for(int i=0;i<=mxvl;i++){
dp[0][i]=INT_MAX;
}
dp[0][0]=0;
dp[0][v[0]]=w[0];
int ans = 0;
for(int i=mxvl;i>=0;i--){
if(minwt(n-1,i)<=wt){
ans = i;
break;
}
}
cout<<ans<<"\n";
}
int main(){
int t=1;//cin>>t;
while(t--){
solve();
}
return 0;
}