// Slower C++ solution:
#include <bits/stdc++.h>



using namespace std;



#define nl '\n'

#define F first

#define S second

#define sz(x) (int)x.size()

#define all(x) x.begin(), x.end()

#define pb push_back



typedef long long ll;

typedef pair<int, int> pii;



const int N = (int)2e5 + 123;

const int K = 500;

const int maxn = (int)2e9;

const int mod = 100000007;

const ll inf = 1ll * 1e18 + 123;



int n;

ll w;

pair<ll, int> p[111];

ll a[100111];

int main(){



   ios_base :: sync_with_stdio(0), cin.tie(0), cout.tie(0);



    #ifdef LOCAL

        freopen("in.txt", "r", stdin);

    #endif



    cin >> n >> w;

    for(int i = 1; i <= n; ++i){

        cin >> p[i].F >> p[i].S;

    }

    for(int i = 0; i <= 100011; ++i) a[i] = -1;

    int sum = 0;

    a[0] = 0;

    sort(p + 1, p + n + 1);

    int ans = 0;

    for(int i = 1; i <= n; ++i){

        sum += p[i].S;

        for(int j = sum; j >= p[i].S; --j){

            if(a[j - p[i].S] != -1){

                ll newW = a[j - p[i].S] + p[i].F;

                if(newW <= w){

                    ans = max(ans, j);

                }

                if(a[j] == -1 || a[j] > newW){

                    a[j] = newW;

                }

            }

        }

    }

    cout << ans;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 1.418122461978511x):
#include <bits/stdc++.h>

#define pb push_back

#define mp make_pair

#define fst first

#define snd second

#define all(cont) cont.begin(), cont.end()

#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define fore(i,a,b) for(int i=a,almo5t=b;i<almo5t;++i)

#define SZ(x) ((int)x.size())

#define EPS 1e-9

#define PI acos(-1)

#define MOD 1000000007

#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





using namespace std;

typedef long long int ll;





ll inf = 1e12 + 5;



int main(){

    FIN;

    //freopen("../../input.txt", "r", stdin);freopen("../../output.txt", "w", stdout); 

    int n,w;cin>>n>>w;

    int N = n*1000 + 1;

    ll dp[n+1][N];



    fore(i,0,n+1){

        fore(j,0,N){

            dp[i][j] = inf;

        }

    }

    vector<pair<int,int>> values;

    fore(i,0,n){

        int wi,vi;cin>>wi>>vi;

        values.pb({wi,vi});

    }



    sort(values.begin(),values.end());



    



    fore(i,1,n+1){

        int wi = values[i-1].first;

        int vi = values[i-1].second;

        dp[i-1][0] = 0;

        fore(j,1,N){

            dp[i][j] = min(dp[i-1][max(j-vi,0)]+wi,dp[i-1][j]);

        }

    }



    /*fore(i,0,n+1){

        fore(j,0,N){

            if(dp[i][j] != inf){

                cout<<dp[i][j]<<" ("<<j<<") ";

            }else{

                cout<<"-1 ";

            }



        }cout<<"\n";

    }*/



    ll ans = 0;

    for(int j = N-1; j>=0 ;j--){

        bool posible = false;



        fore(i,0,n+1){

            if(dp[i][j]<=w){

                posible = true;

            }

        }

        if(posible){

            ans = j;

            break;

        }

    }

    cout<<ans;

    return 0;

}



// ============== Notes =============== //

// common bugs

// - remove reader 

// - fastio

// - int overflow (especially intermediate expressionns)

// - array bounds (indices bigger than MAXN?, is MAXN correct?)

// - special cases (n=1, graph not connected?)

// - re-initialize efficiently between test cases