// Slower C++ solution:
#pragma region

#include <algorithm>

#include <cstring>

#include <iostream>

#include <map>

#include <queue>

#include <stack>

#include <string>

#include <vector>

typedef long long ll;

#define tr t[root]

#define lson t[root << 1]

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

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

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

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

template <typename T>

void read(T &x) {

    x = 0;

    char ch = getchar();

    ll f = 1;

    while (!isdigit(ch)) {

        if (ch == '-') f *= -1;

        ch = getchar();

    }

    while (isdigit(ch)) {

        x = x * 10 + ch - 48;

        ch = getchar();

    }

    x *= f;

}

using namespace std;

/*

 *                                                     __----~~~~~~~~~~~------___

 *                                    .  .   ~~//====......          __--~ ~~

 *                    -.            \_|//     |||\\  ~~~~~~::::... /~

 *                 ___-==_       _-~o~  \/    |||  \\            _/~~-

 *         __---~~~.==~||\=_    -_--~/_-~|-   |\\   \\        _/~

 *     _-~~     .=~    |  \\-_    '-~7  /-   /  ||    \      /

 *   .~       .~       |   \\ -_    /  /-   /   ||      \   /

 *  /  ____  /         |     \\ ~-_/  /|- _/   .||       \ /

 *  |~~    ~~|--~~~~--_ \     ~==-/   | \~--===~~        .\

 *           '         ~-|      /|    |-~\~~       __--~~

 *                       |-~~-_/ |    |   ~\_   _-~            /\

 *                            /  \     \__   \/~                \__

 *                        _--~ _/ | .-~~____--~-/                  ~~==.

 *                       ((->/~   '.|||' -_|    ~~-/ ,              . _||

 *                                  -_     ~\      ~~---l__i__i__i--~~_/

 *                                  _-~-__   ~)  \--______________--~~

 *                                //.-~~~-~_--~- |-------~~~~~~~~

 *                                       //.-~~~--\

 *                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 */



#pragma endregion

const int maxn = 1e5 + 5;

ll n, W, w[maxn], val[maxn], dp[maxn];

int main() {

    IO;

    cin >> n >> W;

    rep(i, 1, n) cin >> w[i] >> val[i];

    rep(i, 1, 1e5) dp[i] = 0x3f3f3f3f;

    dp[0] = 0;

    rep(i, 1, n) for (int t = 1e5; t >= val[i]; --t) dp[t] = min(dp[t], dp[t - val[i]] + w[i]);

    for (int i = 1e5; i; --i)

        if (dp[i] <= W) {

            cout << i << endl;

            return 0;

        }

}

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

using namespace std;

typedef long long int ll;

typedef vector<ll> vi;

typedef pair<ll,ll> ii;



#define pb push_back

#define fst first

#define snd second

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

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

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

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

#define FIN ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)

struct objects{

    int weight,value;

};



int main()

{

    FIN;

#ifdef LOCAL

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

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

#else

#define endl '\n'

#endif

int n,w;

   cin>>n>>w;

   objects object[n];

   int totalvalue=0;

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

       cin>>object[i].weight>>object[i].value;

       totalvalue+=object[i].value;

   }

   ll dp[n+1][totalvalue+1];

   dp[0][0]=0;

   int ans=0;

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

       dp[0][i]=1e18;

   }

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

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

           if(j>=object[i].value){

                dp[i+1][j]=min(dp[i][j], dp[i][j-object[i].value]+object[i].weight);

           }

           else{

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

           }

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

               ans=max(ans,j);

           }

       }

   }

   cout<<ans;

    return 0;

}