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



using namespace std;



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

#define allr(v)				((v).rbegin()), ((v).rend())

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

#define ll long long

#define pb					push_back

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



const ll oo = 1e8;

const double pi = 3.1415926535897;





const double EPS = (1e-7);

int dcmp(double x, double y) {	return fabs(x-y) <= EPS ? 0 : x < y ? -1 : 1;	}





typedef vector<int>                vi;

typedef vector<pair<int,int>>      vii;

typedef vector<ll>                 vll;

typedef vector<double>             vd;

typedef vector< vi >               vvi;

typedef vector< vd >               vvd;

typedef vector<string>             vs;

typedef pair<int, int>             pii;



/**

    * PLEASEEE READDD PROBLEEEM CARFULLY ****

    * Always check for OVERFLOW ll vs int

    * Always check for array bounds

    * Check for function return

    * READ OUTPUT SECTION AGAIN!!!

**/



struct edge{

    int from, to, w;



    edge(){}

    edge(int x, int y, int we): from(x), to(y), w(we){}



    bool operator < (const edge &rhs) const{

        return w > rhs.w;

    }



};



const int N = 100 + 5, V = 1e5 + 5 ;



int dp[V];

int w[N], v[N];

int n, ans = 0;

//

//int sol(int i, int vS, int wS) {

//    if(i == n) {

//        ans = max(ans, vS);

//        return 0;

//    }

//

//    int &ret = dp[i][vS];

//    if(ret != -1) return ret;

//

//    ret = sol(i + 1, vS, wS);

//

//    if(wS - w[i] >= 0) ret = max(ret, sol(i + 1, vS + v[i], wS - w[i]));

//

//    return ret;

//}



int main(){

    fIO



//    freopen("", "r", stdin);

//    freopen("", "w", stdout);



    fill(dp, dp + V, 1e9 + 5);



    int cap;

    cin >> n >> cap;



    for(int i = 0; i < n; i++) cin >> w[i] >> v[i];



    dp[0] = 0;

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

        for(int j = V - 5; j >= 1; j--) {

            if(j >= v[i]) {

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

            }

        }

    }





    for(int i = V - 5; i >= 1; i--) {

        if(dp[i] <= cap) {

            cout << i << "\n";

            break;

        }

    }

}
















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

using namespace std;

typedef long long int ll;

typedef vector<ll> vi;

typedef pair<ll,ll> ii;



#define pb push_back

#define fst first

#define snd second

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

#define mset(a,b) memset(a,b,sizeof(a));

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

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

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

struct objects{

    int weight,value;

};



int main()

{

    FIN;

#ifdef LOCAL

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

    freopen("output.txt", "w", stdout);

#else

#define endl '\n'

#endif

int n,w;

   cin>>n>>w;

   objects object[n];

   int totalvalue=0;

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

       cin>>object[i].weight>>object[i].value;

       totalvalue+=object[i].value;

   }

   ll dp[n+1][totalvalue+1];

   dp[0][0]=0;

   int ans=0;

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

       dp[0][i]=1e18;

   }

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

       for(int j=0;j<=totalvalue;j++){

           if(j>=object[i].value){

                dp[i+1][j]=min(dp[i][j], dp[i][j-object[i].value]+object[i].weight);

           }

           else{

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

           }

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

               ans=max(ans,j);

           }

       }

   }

   cout<<ans;

    return 0;

}