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

#define fastio ios_base::sync_with_stdio(0);cin.tie(0)

#define fst first

#define snd second

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

#define pb push_back

#define sz size()

#define FORN(i,j,n) for(long long i=j; i<(long long)n;i++) 

#define FOR(i,n) FORN(i,0,n)

#define FORIT(i,x) for( auto i = x.begin() ; i != x.end() ; i++ )

#define MOD 998244353LL

#define LIM 262150

#define ones(x) __builtin_popcount(x)

#define trace(x)    cerr << #x << ": " << x << endl;

#define trace2(x, y) cerr << #x << ": " << x << " | " << #y << ": " << y << endl;

using namespace std;

 

typedef long long ll ;

typedef unsigned long long ull ;

typedef vector <int> vi;

typedef pair <int,int> ii;

typedef vector <string> vs;

typedef vector <ii> vii;

ll n,w;

ll ans = 0;

ll dp[105][100005];

ll v[105];

ll p[105];

int main() {

	fastio;

	cin>> n >> w;

	FORN(i,1,n+1) cin>> p[i] >> v[i];

	FOR(i,n+1){

		FOR(j,1e5+1){

			dp[i][j] = 1e14;

		}

	}

	FORN(i,0,n+1){

		FOR(j,1e5+1){

		    if(j == 0){ dp[i][j] = 0; continue; }

		    if(i == 0){ dp[i][j] = 1e14; continue; }

			if(j >= v[i]){

				dp[i][j] = min( dp[i-1][j-v[i]] + p[i] , dp[i-1][j]);

			}

			else{

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

			}

		}

	}

	FOR(i,1e5+1){

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

			ans = max(ans,i);

		}

	}

	cout<< ans << '\n'; 

	//cout<< dp[3][100000] << '\n';

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.538427351843641x):
#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