//not submitted
#include <bits/stdc++.h>
#include<iostream>
 
# define C continue;
# define R return
 
# define D double
# define I insert
# define ll long long
# define ld long double
 
# define ull unsigned long long
# define ui unsigned int
 
# define pb push_back
# define pf push_front
 
# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue
 
# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >
 
# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp
 
# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >
# define pipii pair<int, pii >
# define pcpii pair<char,pii>
 
# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >
 
# define vvpii vector < vector < pii > >
# define vpipii vector< pipii >

# define F first
# define S second
# define mp make_pair

# define unm unordered_map
# define unmii unm< int , int >
# define unmll unm< ll , ll >
# define unms unm<string,int>
# define unmci unm<char,int>
 
# define sortvia sort(a.begin(),a.end());
# define sortvib sort(b.begin(),b.end());
# define revsorta sort(a.begin(), a.end(), greater <int>());
# define revsortb sort(b.begin(), b.end(), greater <>());
# define loop(q,n) for(int i=q;i<n;i++)
# define loopj(r,n) for(int j=r;j<n;j++)
# define loopm(s,m) for(int k=s;k<m;k++)
# define test int t;cin >> t;while(t--)
# define nextline "\n"
# define tab "\t"
# define space " "
//YES
//NO
//cout
//true
//false
//yes
//no

const ll mod9=1e9+7;
const ll maxsize=2e9+1;
const ll mod =998244353;
const ll mod2=1073741824;
const ll INF=1e18L+5;

using namespace std;


int main()
{
/*ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif*/
    int n;
    ll w;
    cin>>n>>w;
    vi value(n+1);
    vll wieght(n+1);
    ll sum_value=0;
    loop(0,n){
        cin>>wieght[i]>>value[i];
        sum_value+=value[i];
    }
    /*loop(0,n){
        cout<<value[i]<<space<<wieght[i]<<nextline;
    }*/

    //values are stored in vector of values
    //wieghts are stored in vector of wieghts
    //key concept is that we make a dp which stored min wieght for a particular value
    //max size of dp will be the sum of values as in we can only take values once
    //then at the end we will find max value stored in the dp provided that wieght for that is less than the required wieght
    vll dp(sum_value+1,INF);
    dp[0]=0;
    for (int item=0;item<n;item++){
        //chosing item
        for(int value_already=sum_value-value[item];value_already>=0;value_already--){
            //for a particular item we check for all values lesser than sum_value-value[item] as we dont want index of dp to exceed sum_value
            //wether is it possible to get wieght for a value lesser than that is already there
            dp[value_already+value[item]]=min(dp[value_already+value[item]],dp[value_already]+wieght[item]);
        }
    }
    /*for(ll i=0;i<=sum_value;i++){
        cout<<i<<space<<dp[i]<<nextline;
    }*/
    //now fetching answer
    //answer
    ll answer=0;
    for(int i=1;i<=sum_value;i++){
        if(dp[i]<=w){
            answer=max(answer,(ll) i);
        }
    }
    cout<<answer;

}


Measured memory_bytes: 1024