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



using namespace std;





typedef long long ll;



const int MAX = 1e5+5;

ll dp[MAX+MAX];



int n , W;







int main()

{



    ios_base::sync_with_stdio(0);cin.tie(0);

    cin>>n>>W;



    for( int j = 0 ; j < MAX+MAX ; j++ )

        dp[j] = LONG_LONG_MAX;





    dp[0] = 0;

    ll ans = 0;

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





        ll w , v;

        cin>>w>>v;



        for( int j = MAX ; j >= 0 ; j-- ) {



            if( dp[j] != LONG_LONG_MAX ) {



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

                if( dp[j+v] <= W )

                ans = max( ans , j+v );



            }



        }



    }



    cout<<ans<<"\n";

}


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

#define ll long long

#define pii pair<ll int,ll int>

#define PI 2*acos(0)

//#define mx 100005

#define INF 1e16

using namespace std;

const ll int p=1000000007;

//vector<ll > prime;

//bool mark[mx];

ll int mod(ll int a,ll int b)

{

    ll int m=a%b;

    if(m<0) m=(b<0)?(m-b):(m+b);

    return m;

}

ll maxpow(ll n)

{

    return (n & (~(n-1)));

}

bool isPrime(ll n)

{

    if(n<2) return false;

    if(n==2) return true;

    if(n%2==0) return false;

    for(ll i=3;i*i<=n;i+=2){

        if(n%i==0) return false;

    }

    return true;

}

/*void init()

{

    mark[1]=1;

    int i,j,limit=sqrt(mx*1.0)+2;

    prime.push_back(2);

    for(i=4;i<mx;i+=2) mark[i]=1;

    mark[2]=0;

    for(i=3;i<mx;i+=2){

        if(!mark[i]){

            prime.push_back(i);

            if(i<=limit){

                for(j=i*i;j<mx;j+=2*i){

                    mark[j]=1;

                }

            }

        }

    }

}*/

/*

ll maxdiv(ll n)

{

    ll i,ans=1;

    for(i=0;i<prime.size();i++){

        if(n%prime[i]==0){

            ans=n/prime[i];break;

            //return ans;

        }

    }

    return ans;

}*/

ll lcm(ll a,ll b)

{

    ll ans=a*b;

    return (ans/__gcd(a,b));

}

// ax+by and a>b

ll gcd(ll a,ll b,ll &x,ll &y)

{

    if(b==0){

        x=1;

        y=0;

        return a;

    }

    ll x1,y1;

    ll d=gcd(b,mod(a,b),x1,y1);

    x=y1;

    y=x1-y1*(a/b);

    return d;

}

ll abso(ll a)

{

    if(a>=0) return a;

    return -a;

}

int main()

{

    ios::sync_with_stdio(0);

    cin.tie(0);

    //ll mx=100005;

    //cout<<mx<<"\n";

    ll i,j,n,x;

    cin>>n>>x;

    ll w[n+1],v[n+1];

    ll V=0;

    for(i=1;i<=n;i++){ cin>>w[i]>>v[i]; V+=v[i]; }

    // dp[i] denotes the minimum total weight of items with total value exactly i;considering each item only once

    ll dp[V+1];

    for(i=1;i<=V;i++) dp[i]=INF;

    dp[0]=0;

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

        // considering the i th item ,as we are going from left to right ,we are considering each item only once

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

            // if this was an increasing loop then this program will make the mistake of using one item more than once

            // every element can be used only once ,therefore the loop is a decreasing loop

            // now we will see if taking the current item will effect any value

            // any value that can be updated can range from v[i] to V , so we will consider all the possibilities

            // before updating dp[j],let's think for a while , we have already updated the list upto (i-1) th item

            // either the j th value will change or it won't

            // we have two options , either we can take the i'th element (1) or not (2)

            // (1) the j th state will remain unchanged

            // (2) or it will be changed by dp[j-v[i]]+w[i]

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

            //cout<<"i="<<i<<" j="<<j<<" "<<dp[j]<<"\n";

        }

    }

    for(i=V;i>=0;i--){

        if(dp[i]<=x){

            cout<<i;

            return 0;

        }

    }

    return 0;

}

//1028C