// Original C++ solution (slower):


#include <bits/stdc++.h>

#include <stdio.h>

#include <algorithm>

 

using namespace std;

#define rep(i,a,b) for (ll i = a; i < b; i++)

#define rrep(i,a,b) for (ll i = a; i >= b; i--)

#include <bits/stdc++.h>

#include <stdio.h>

#include <algorithm>

 

using namespace std;

#define rep(i,a,b) for (ll i = a; i < b; i++)

#define rrep(i,a,b) for (ll i = a; i >= b; i--)

#define l(s) s.length()

#define sort(v) sort(v.begin(), v.end());

#define scan(v,n) rep(i,0,n) {ll k; cin >> k; v.pb(k);}

#define print(v,n) {rep(i,0,n) cout << v[i] << " "; cout << endl;}

#define printstr(s,n) {rep(i,0,n) cout << s[i]; cout << endl;}

#define rev(a) reverse(a.begin(), a.end());

#define pb push_back

typedef long long ll;

typedef long double lld;

typedef vector<pair<ll,ll>> vpi;

typedef vector<ll> vi;

 

const ll mxN=1e5+1;

const ll N=1e18+7;

 

ll dp[mxN+1];

 

  int main() {

      int T=1;// cin >> T;

      while(T--){

          ll n,W,sum=0; cin >> n >> W;

          rep(i,1,100001) dp[i]=N;

          rep(i,0,n) {

              ll w,v;

              cin >> w >> v;

              sum+=v;

              rrep(x,100001,0) {

                  if(x>=v&&dp[x]>dp[x-v]+w) dp[x]=dp[x-v]+w;

              }

          }

          ll ans=0;

          rrep(i,mxN-1,0){

              if(dp[i]<=W){

                  cout << i;

                  break;

              }

          }

          //cout << ans;

      } 

	 return 0;

}


// Optimized solution to the same problem (faster):


#include <bits/stdc++.h>

#include <stdio.h>

#include <algorithm>

 

using namespace std;

#define rep(i,a,b) for (ll i = a; i < b; i++)

#define rrep(i,a,b) for (ll i = a; i >= b; i--)

#include <bits/stdc++.h>

#include <stdio.h>

#include <algorithm>

 

using namespace std;

#define rep(i,a,b) for (ll i = a; i < b; i++)

#define rrep(i,a,b) for (ll i = a; i >= b; i--)

#define l(s) s.length()

#define sort(v) sort(v.begin(), v.end());

#define scan(v,n) rep(i,0,n) {ll k; cin >> k; v.pb(k);}

#define print(v,n) {rep(i,0,n) cout << v[i] << " "; cout << endl;}

#define printstr(s,n) {rep(i,0,n) cout << s[i]; cout << endl;}

#define rev(a) reverse(a.begin(), a.end());

#define pb push_back

typedef long long ll;

typedef long double lld;

typedef vector<pair<ll,ll>> vpi;

typedef vector<ll> vi;

 

const ll mxN=1e5;

const ll N=1e9+7;

 

int dp[mxN+1];



//dp[i][j][2] is the score of each player when the remaining array is from index i to j

// dp[0][n-1]=0

//rep(i,1,n+1) cout max of dp[i][i-1][1]







  int main() {

      int T=1;// cin >> T;

      while(T--){

          ll n,W,sum=0; cin >> n >> W;

          rep(i,1,mxN+1) dp[i]=N;

          rep(i,0,n) {

              ll w,v;

              cin >> w >> v;

              sum+=v;

              rrep(x,sum,0) {

                  if(x>=v&&dp[x]>dp[x-v]+w) dp[x]=dp[x-v]+w;

              }

          }

          ll ans=0;

          rrep(i,sum,0){

              if(dp[i]<=W) {

                  cout << i; 

                  break;

              }

          }

          //cout << ans;

          

      } 

	 return 0;

}


// Fastest known solution for this problem: