// Slower C++ solution:
/**

 *  Author : Coda

 *  Title : OSU!

 *  Date : 2019-08-20

 */

#include <bits/stdc++.h>

using namespace std ;



typedef long long ll ;

typedef unsigned long long ull ;

typedef double DB ;

const long long mod = 1e9+7 ;

const double pi = acos(-1) ;

#define PB push_back

#define MP make_pair

#define lb lower_bound

#define ub upper_bound

#define fs first

#define sd second

#define pii pair<int,int>

#define INF 0x3f3f3f3f

#define LLINF 0x3f3f3f3f3f3f3f3f

#define debug(x) cout << #x << " = " << x << endl

#define debug2(x,y) cout << #x << " = " << x << ' ' << #y << " = " << y << endl

#define debug3(x,y,z) cout << #x << " = " << x << ' ' << #y << " = " << y << ' ' << #z << " = " << z << endl

//#pragma comment(linker,"/STACK:10240000,10240000")

//#include <random>

//mt19937 rand_(time(0));

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

ll qpow(ll a,ll b,ll c){ll t=1;while(b){if(b&1)t=t*a%c;a=a*a%c;b>>=1;}return t;}

ll inv(ll x){return qpow(x,mod-2,mod);}

int test = 1 ;



const int maxn = 5 + 3e5 ;

const int maxm = 5 + 1e6 ;

// Write the variables here



int N,W ;

ll v[maxn],w[maxn] ;

ll dp[maxn] ;



//#define TEST

int main(){

#ifdef TEST

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

#endif

    while(test--){

        // code begins

        scanf("%d%d",&N,&W) ;



        ll sum = 0 ;

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

            scanf("%lld%lld",&w[i],&v[i]) ;

        }

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

            dp[i] = LLINF ;

        }

        dp[0] = 0;

        ll ans = 0 ;

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

            for(int j=100000 ; j>=v[i] ; j--){

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

            }

        }

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

            if(dp[i]<=W) ans = max(ans,i*1ll) ;

        }

        printf("%lld\n",ans) ;



    }

#ifdef TEST

    cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;

#endif

    return 0 ;

}


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

#define int long long

#define ll long long

#define ld long double

#define mod ((ll)1e9+7)

#define maxx ((ll)1e6+5)

#define pb push_back

#define ins insert

#define usefile freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);

#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#define test ll t; cin>>t; while(t--)

ll exp(ll x,ll y,ll p){ ll res=1; while(y) {if(y%2) res=(res*x%p)%p; x=(x*x)%p; y/=2; } return res;}

ll expo(ll x,ll y){ ll res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}

using namespace std;//ok i saw

signed main()

{

    int n,W,i,j,k;

    cin >> n >> W;

    int w[n+1],v[n+1],maxv=0;

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

    {

    	cin >> w[i] >> v[i];

    	maxv =max(maxv , v[i]);

    }

    int d[n+1][maxv*n +1];

    int col = maxv*n;

    for(i=0 ; i<=n ; i++)

		for(j=0 ; j<=col ; j++)

			d[i][j] = -1;

	for(i=1 ; i<=col ; i++)

		d[0][i] = -1;

	for(i=0 ; i<=n ; i++)

		d[i][0] = 0;

	int ans = 0;

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

	{

		for(j=1 ; j<=col ; j++)

		{

			if(v[i] <= j && (d[i-1][j-v[i]] != -1 ))

				d[i][j] = w[i] + d[i-1][j-v[i]];

			if(d[i-1][j] != -1 && d[i][j] != -1)

				d[i][j] = min(d[i-1][j] , d[i][j]);

			else if(d[i-1][j] != -1 ) 

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

			if(d[i][j] >= 0 && d[i][j] <= W)

				ans = max(ans,j);

				//cout<<d[i][j]<<" ";

		}//cout<<"\n";

	}

	cout << ans <<"\n";

    return 0;

}