// 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.24524373747913x):
#include <cstring>

#include <iostream>

#include <string>

#include <vector>

#include <algorithm>

#include <sstream>

#include <queue>

#include <deque>

#include <bitset>

#include <iterator>

#include <list>

#include <stack>

#include <map>

#include <set>

#include <functional>

#include <numeric>

#include <utility>



const int INF = 0x3f3f3f3f;



using namespace std;

int main()

{

	ios::sync_with_stdio(false);

	cin.tie(0);



	int n, w;

	cin >> n >> w;

	int value_max = n*1000+1;

	int n_max = n + 1;

	int dd[n_max][value_max];



	// initialize

	memset(dd, INF, sizeof dd);

	/*

	for (int nn = 0; nn < n_max; nn++) {

	  for (int v = 0; v < value_max; v++) {

	    dd[nn][v] = INF;

	  }

	}

	*/



	for (int nn = 0; nn <= n; nn++) {

	  dd[nn][0] = 0;

	}

	for (int nn = 1; nn < n_max; nn++) {

	  int www, nu;

	  cin >> www >> nu;

	  for (int v = 1; v < value_max; v++) {

	    // don't use item nn-1

	    int cur = dd[nn-1][v];



	    // use item nn-1

	    if (nu <= v) {

	      int rem_v = v - nu;

	      int cand = dd[nn-1][rem_v] + www;

	      if (cand <= w && cand < cur) {

		cur = cand;

	      }

	    }



	    dd[nn][v] = cur;

	  }

	}

	bool done = false;

	for (int v = value_max-1; v >= 0; v--) {

	  if (done) {

	    break;

	  }

	  for (int nn = 0; nn < n_max; nn++) {

	    if (dd[nn][v] != INF) {

	      cout << v << '\n';

	      done = true;

	      break;

	    }

	  }

	}



	if (!done) {

	  cout << 0 << '\n';

	}

	return 0;

}