/////////////////////////////////////////////////////////////////////////////////
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$'               `$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$//  
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$'                   `$$$$$$$$$$$$$$$$$$$$$$$$$$$$//
//$$$'`$$$$$$$$$$$$$'`$$$$$$!                       !$$$$$$'`$$$$$$$$$$$$$'`$$$//
//$$$$  $$$$$$$$$$$  $$$$$$$                         $$$$$$$  $$$$$$$$$$$  $$$$//
//$$$$. `$' \' \$`  $$$$$$$!       $$        $$      !$$$$$$$  '$/ `/ `$' .$$$$//
//$$$$$. !\  i  i .$$$$$$$$       $$$$      $$$$      $$$$$$$$. i  i  /! .$$$$$//
//$$$$$$   `--`--.$$$$$$$$$        $$        $$       $$$$$$$$$.--'--'   $$$$$$//
//$$$$$$L        `$$$$$^^$$                           $$^^$$$$$'        J$$$$$$//
//$$$$$$$.   .'   ""~   $$$    $.                 .$  $$$   ~""   `.   .$$$$$$$//
//$$$$$$$$.  ;      .e$$$$$!    $$.             .$$  !$$$$$e,      ;  .$$$$$$$$//
//$$$$$$$$$   `.$$$$$$$$$$$$     $$$.         .$$$   $$$$$$$$$$$$.'   $$$$$$$$$//
//$$$$$$$$    .$$$$$$$$$$$$$!     $$`$$$$$$$$'$$    !$$$$$$$$$$$$$.    $$$$$$$$//
//$$$$$$$     $$$$$$$$$$$$$$$$.    $    $$    $   .$$$$$$$$$$$$$$$$     $$$$$$$//
//                                 $    $$    $								   //
//                                 $.   $$   .$								   //
//                                `$        $'								   //
//                                 `$$$$$$$$'								   //
/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////

#include <bits/stdc++.h>
using namespace std;

// Type-Define 
typedef long long ll;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef std::vector<char> vc;
typedef std::vector< vector<int> > vii;
typedef std::pair<int, int> pii;

// Hash-Define
#define int long long
#define MOD 1000000007
#define debugStart cerr << "\n[DEBUG START]\n"
#define debugStop cerr << "\n[DEBUG STOP]\n"
#define KHATAM cout << std::endl;
#define set_zero(x) memset(x, 0, sizeof(x));
#define ForPrint(x) std::for_each( begin(x), end(x), []( auto const& el ){ std::cout << el << " ";  } )

//Functions 
template<typename T> auto gcd ( T a, T b ) -> int  { return (b==0)?a:gcd(b,a%b); }

const int inf = 1e9 + 5;
int weight[1000];
int value[1000];

auto solve ( int size, int W ) -> int {

    //dp[V] : minimum weight for given value.
    int value_sum = std::accumulate(value, value + size, 0); 
    int dp[value_sum+1];
    for( int i = 0; i <= value_sum; ++i ) dp[i] = inf;
    dp[0] = 0;
    for ( int i = 0; i < size; ++i ) {
        for ( int v = value_sum; v >= 0; --v ) {
            if ( v + value[i] <= value_sum  ) {
                dp[v + value[i]] = std::min( dp[v + value[i]], dp[v] + weight[i] );
            }
        }
    }
    for ( int answer = value_sum; answer >= 0; --answer ) {
        if ( dp[answer] <= W ) {
            return answer;
        }
    }
    return 0;

}

signed
main() {

    ios::sync_with_stdio(0);
    cin.tie(0);
    int T = 1; 
    for ( int testcase = 1; testcase <= T; ++testcase ) {
        int size, W;
        std::cin >> size >> W;
        for ( int i = 0; i < size; ++i ) std::cin >> weight[i] >> value[i];
        std::cout << solve( size, W ) ;
        KHATAM;
    }
    return 0;
}


Measured memory_bytes: 1024