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

using namespace std;

typedef long long ll;

typedef unsigned long long ull;

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

#define     bug(a,b)        cout<<a<<"\t"<<b<<"\n";

#define     Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";

#define     watch(a)        cout<<fixed<<setprecision(a)

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

#define     Endl            "\n";

#define     tab             "\t"

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

#define     sfl(a)          scanf(" %lld", &a);

#define     sf(a)           scanf(" %d", &a);

#define     srt(a)          sort(a.begin(),a.end());

#define     pi              2*acos(0.0)

const int sz=1e5+9;

const ll inf=1e18L+9;

ll dp[sz];





void solve(){

    reset(dp,inf);

    int n,w;

    sf(n);

    sf(w);

    vector<pair<ll,int>>v(n);

    dp[0]=0;

    int pnt=0;

    lp(i,0,n){

       sfl(v[i].first);

       sf(v[i].second);

       pnt+=v[i].second;

    }

    //bug(pnt, 1);

   // sort(v.begin(),v.end(),com);

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



        for(int j=pnt-v[i].second;j>=0;j--){

            dp[j+v[i].second]=min( dp[j+v[i].second],dp[j]+v[i].first);

        }



    }

   // bug("140 dp",dp[140]);

    for(int i=pnt;i>=0;i--){

        if(dp[i]<=w){

            printf("%d\n",i);

            return;

        }

    }

}



int main(){

    //FasterIO;

    #ifndef ONLINE_JUDGE

    //    freopen("1.txt","r",stdin);

    #endif

    //int t;

//cin>>t;

   // while(t--)

        solve();

}

// Faster C++ solution for the same problem (measured speedup: 1.747067309562971x):
// Author : ZERO_IQ

// Practice is the only shortcut to improve



#pragma GCC optimize ("O3")

#pragma GCC optimize ("unroll-loops")



#include <bits/stdc++.h>



using namespace std;

using ll = long long;



#define debug(x, y) cerr << (#x) << " " << (#y) <<" is " << (x) <<" "<< (y) << endl

#define debug2(x, y, z) cerr << (#x) << " " <<(#y) << " " << (#z) << " is " << (x) << " " << (y) << " " << (z) << endl

#define endl '\n'



ll const N = 1e7 + 1;



int main() {

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

    /*#ifndef ONLINE_JUDGE

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

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

    #endif*/

    long long n, m;

    cin >> n >> m;

    vector<pair<long long, long long >> input;

    long long summ = 0;

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

        long long q, qq;

        cin >> q >> qq;

        input.push_back({q, qq});

        summ += qq;

    }

    vector<vector<long long>> dp(n, vector<long long>(summ + 2, 1e18));

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

        dp[var][0] = 0;

    }

    ll maxx = 0;

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

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

            if (!j) {

                if (i == input[j].second)

                    dp[j][i] = input[j].first;

            } else if (input[j].second > i) {

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

            } else {

                dp[j][i] = min(dp[j - 1][i], dp[j - 1][i - input[j].second]

                               + input[j].first);

            }

        }

    }

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

        if (dp[n - 1][i] <= m) {

            maxx = i;

        }

    }

    cout << maxx << endl;

    return 0;

}