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

#define MAX 100005

#define pb push_back

#define mp make_pair

#define pii pair<long long,long long>

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

#define p1(a) cout<<"Check "<<a<<endl;

#define p2(a,b) cout<<"Check "<<a<<' '<<b<<endl;

#define p3(a,b,c) cout<<"Check "<<a<<' '<<b<<' '<<c<<endl;

#define fo(i,n) for(i=0;i<n;i++)

#define ll long long

#define clr(a) memset(a,0,sizeof(a))

#define MOD 10000000000

#define INF 10000000000000



using namespace std;



int n,cp;

ll cost[MAX];

ll weight[MAX];

ll dp[MAX];





int main()

{

    cin>>n>>cp;

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

        scanf("%lld%lld",&weight[i],&cost[i]);

    }

    for(int i=0;i<=MAX;i++) dp[i]=INF;

    dp[0]=0;

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

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

            if(j-cost[i]>=0 && dp[j-cost[i]]!=INF){

                dp[j]=min(dp[j],dp[j-cost[i]]+weight[i]);

            }

        }

    }

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

        if(dp[j]<=cp){

            cout<<j<<endl;

            break;

            //break;

        }

    }



    return 0;

}


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

        }

    }

}