// Slower C++ solution:
#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;

        }

    }

}
















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

#include <unordered_map>

#include <unordered_set>

#define endl '\n'

#define PI acos(-1)

typedef long long ll;

using namespace std;

int n;

ll **dp, w;

pair<ll, int> *x;

ll nap(int i, int rem)

{

    if(i == n && rem)

        return (ll)1e9 + 1;

    else if(!rem)

        return 0;

    if(~dp[i][rem])

        return dp[i][rem];

    ll first = nap(i + 1, rem), second = (ll)1e9 + 1;

    if(rem >= x[i].second)

        second = x[i].first + nap(i + 1, rem - x[i].second);

    return dp[i][rem] = min(first, second);

}

int main()

{

    //cin.tie(NULL); cout.tie(NULL);  ios_base::sync_with_stdio(false);

    #ifndef ONLINE_JUDGE

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

        //freopen("out.txt", "w", stdout);

    #endif

    scanf("%d %lld", &n, &w);

    x = new pair<ll, int>[n];

    int mx = 0;

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

    {

        scanf("%lld %d", &x[i].first, &x[i].second);

        mx += x[i].second;

    }

    dp = new ll*[n];

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

    {

        dp[i] = new ll[mx + 1];

        memset(dp[i], -1, (mx + 1) * 8);

    }

    for(int i = mx; i >= 0; i--)

        if(nap(0, i) <= w)

        {

            printf("%d", i);

            break;

        }

}