// Slower C++ solution:
/**

 *    Creator :  bizarre

 *    Date : 4/2020

 *    Problem Number : 427

**/

#include <bits/stdc++.h>

using namespace std;

#define bizarre     ios_base::sync_with_stdio( false ), cin.tie( nullptr ), cout.tie( nullptr );

/*

vector<int> prime_Numbers;

int primes[1000005];

void prime(int n)

{

    primes[1]=primes[0]=0;

    for(int i=2; i<=n; i++)

        primes[i]=true;

    for(int i=2; i<=n; i++)

    {

        if(primes[i]==true)

        {

            prime_Numbers.push_back(i);

            for(int j=i+i; j<=n; j+=i)

                primes[j]=false;

        }

    }

    for(int i=2; i<=n; i++)

        primes[i]+=primes[i-1];

}



void move1step(long long& a, long long& b, long long q)

{

    long long c= a-q*b;

    a=b;

    b=c;

}

long long egcd(long long r0,long long r1,long long& x0,long long& y0)

{

    long long x1=0,y1=1;

    x0=1;

    y0=0;

    while(r1)

    {

        long long q=r0/r1;

        move1step(r0,r1,q);

        move1step(x0,x1,q);

        move1step(y0,y1,q);

    }

    return r0;

}

bool  solve (long long a, long long b, long long c,long long&x, long long& y)

{

    long long g=egcd(a,b,x,y);

    int m=c/g;

    x*=m;

    y*=m;

    return c%g==0;

}







int npr(long long n, long long r)

{

    return (fact[n] * inv[n - r]) % mod;

}



int gcd(int a, int b)

{

    if(b==0)

        return a;

    return gcd(b,a%b);

}

void PrimeFactorization(int n)

{

    for(int i=2; i*i<=n; i++)

    {

        int c=0;

        if(n%i==0)

        {

            while(n%i==0)

            {

                n/=i;

            }



        }

    }



}

const int inf = 2e9, mod = 1e9 + 7,N=1e5+5;

long long fact[N], inv[N];

long long fp(long long base, long long exp)

{

    if (exp == 0)

        return 1;

    long long ans = fp(base, exp / 2);

    ans = (ans * ans) % mod;

    if (exp % 2 != 0)

        ans = (ans * (base % mod)) % mod;

    return ans;

}

void pre(long long n)

{

    fact[0] = 1;

    inv[0] = 1;

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

    {

        fact[i] = (i * fact[i - 1]) % mod;

        inv[i] = fp(fact[i], mod - 2);

    }

}

int ncr(long long n, long long r)

{

    return (((fact[n] * inv[n - r]) % mod) * inv[r]) % mod;

}

long long ncrtane(long long n, long long r)

{

    long long ans=1,cntr=1;

    for(int i=n;i>n-r;i--)

    {

        ans*=i;

        ans/=cntr;

        cntr++;

    }

    return ans;

}

*/

long long dp[100005],v[100005],w[100005],V;

int main()

{

    bizarre

     long long n,x,ans=0;

     cin>>n>>x;

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

    {

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

        V+=v[i];

    }

    memset(dp,0x3f3f3f3f,sizeof dp);

    dp[0]=0;

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

    {

        for(int j=V;j>0;j--)

        {

            if(j-v[i]>=0)

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

        }

    }

    for(int i=0;i<=V;i++)

    {

        if(dp[i]<=x)

            ans=max(ans,(long long)i);

    }

    cout <<ans;

    return 0;

}


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

#define pb push_back

#define mp make_pair

#define fst first

#define snd second

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

#define foreach(it, l) for (auto it = l.begin(); it != l.end(); it++)

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

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

#define EPS 1e-9

#define PI acos(-1)

#define MOD 1000000007

#define FIN std::ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





using namespace std;

typedef long long int ll;





ll inf = 1e12 + 5;



int main(){

    FIN;

    //freopen("../../input.txt", "r", stdin);freopen("../../output.txt", "w", stdout); 

    int n,w;cin>>n>>w;

    int N = n*1000 + 1;

    ll dp[n+1][N];



    fore(i,0,n+1){

        fore(j,0,N){

            dp[i][j] = inf;

        }

    }

    vector<pair<int,int>> values;

    fore(i,0,n){

        int wi,vi;cin>>wi>>vi;

        values.pb({wi,vi});

    }



    sort(values.begin(),values.end());



    



    fore(i,1,n+1){

        int wi = values[i-1].first;

        int vi = values[i-1].second;

        dp[i-1][0] = 0;

        fore(j,1,N){

            dp[i][j] = min(dp[i-1][max(j-vi,0)]+wi,dp[i-1][j]);

        }

    }



    /*fore(i,0,n+1){

        fore(j,0,N){

            if(dp[i][j] != inf){

                cout<<dp[i][j]<<" ("<<j<<") ";

            }else{

                cout<<"-1 ";

            }



        }cout<<"\n";

    }*/



    ll ans = 0;

    for(int j = N-1; j>=0 ;j--){

        bool posible = false;



        fore(i,0,n+1){

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

                posible = true;

            }

        }

        if(posible){

            ans = j;

            break;

        }

    }

    cout<<ans;

    return 0;

}



// ============== Notes =============== //

// common bugs

// - remove reader 

// - fastio

// - int overflow (especially intermediate expressionns)

// - array bounds (indices bigger than MAXN?, is MAXN correct?)

// - special cases (n=1, graph not connected?)

// - re-initialize efficiently between test cases