// Slower C++ solution:
#include <iostream>

#include <algorithm>

#include <cmath>

#include <cstdlib>

#include <cstdio>

#include <cstring>

#include <iomanip>

#include <string>

#include <set>

#include <vector>

#include <queue>

#include <stack>

using namespace std;

#define ms(a, x) memset(a, x, sizeof(a))

#define fore(i, a, n) for (long long i = a; i < n; i++)

#define ford(i, a, n) for (long long i = n - 1; i >= a; i--)

#define si(a) scanf("%d", &a)

#define sii(a, b) scanf("%d%d", &a, &b)

#define debug(a) cout << a << endl

#define endl '\n'

#define pi acos(-1.0)

#define tr t[root]

#define lson t[root << 1]

#define rson t[root << 1 | 1]

#define IO ios::sync_with_stdio(false), cin.tie(0)

const double eps = 1e-8;

inline int sgn(const double &x) { return x < -eps ? -1 : x > eps; }

typedef long long ll;

const int inf = 0x3f3f3f3f;

const int maxn=1000100;

#define maxn0 1e9+7;

//=================================================



ll sum;

ll w[maxn];

ll dp[maxn];

ll v[maxn];



// void init() {

//     for(ll i=0;i<=n;i++){

//         w[i]=0;

//         v[i]=0;

//     }

// }

int main() {

    IO;

    ll n,W;

    cin>>n>>W;

    // sum=0;

    // init();

    memset(dp,inf,sizeof(dp));

    dp[0]=0;

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

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

        // sum+=v[i];

    }

    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]);

        }

    }

    ll ans=-1;

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

        if(dp[i]<=W)

            ans=max(ans,1LL*i);

    }

    cout<<ans<<endl;



    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 8.25580984449014x):
#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