// Slower C++ solution:
// {{{ Headers

// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}}



#include <cassert>

#include <cctype>

#include <cmath>

#include <climits>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>



#include <algorithm>

#include <deque>

#include <functional>

#include <iterator>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <utility>

#include <vector>



#include <fstream>

#include <iostream>

#include <sstream>



using namespace std;

// }}}



typedef long long int64;

const int INF = 0x3f3f3f3f;

const int64 LINF = (int64) 1e15;

template <class T> inline int len (const T &a) { return a.size (); }

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



int64 dp [2][100 * 1000 + 5];

int v [100 * 1000 + 5];

int w [100 * 1000 + 5];

int N, W;



int

main () {

    scanf ("%d %d", &N, &W);

    for (int i = 0; i < N; i++) scanf ("%d %d", w + i, v + i);

    for (int j = 0; j <= 100000; j++)

        dp [0][j] = LINF;



    dp [0][0] = 0;

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

        int t = i & 1;

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

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

            if (j >= v [i - 1])

                dp [t][j] = min (dp [t][j], dp [1 - t][j - v [i - 1]] + w [i - 1]);

        }

    }



    int ret = 0;

    for (int j = 0; j <= 100000; j++)

        if (dp [N & 1][j] <= W)

            ret = max (ret, j);



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





#ifdef LOCALHOST

	cerr << "time: " << (int64) clock () * 1000 / CLOCKS_PER_SEC << " ms" << endl;

#endif

    return 0;

}




// Faster C++ solution for the same problem (measured speedup: 1.297848223101176x):
// {{{ Headers

// vim:filetype=cpp:foldmethod=marker:foldmarker={{{,}}}



#include <cassert>

#include <cctype>

#include <cmath>

#include <climits>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <ctime>



#include <algorithm>

#include <deque>

#include <functional>

#include <iterator>

#include <list>

#include <map>

#include <numeric>

#include <queue>

#include <set>

#include <stack>

#include <string>

#include <utility>

#include <vector>



#include <fstream>

#include <iostream>

#include <sstream>



using namespace std;

// }}}



typedef long long int64;

const int INF = 0x3f3f3f3f;

const int64 LINF = (int64) 1e15;

template <class T> inline int len (const T &a) { return a.size (); }

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



int64 dp [100 * 1000 + 5];

int v [100 * 1000 + 5];

int w [100 * 1000 + 5];

int N, W;



int

main () {

    scanf ("%d %d", &N, &W);

    for (int i = 0; i < N; i++) scanf ("%d %d", w + i, v + i);

    for (int j = 0; j <= 100000; j++)

        dp [j] = LINF;



    dp [0] = 0;

    for (int i = 1; i <= N; i++)

        for (int j = 100000; j >= 0; j--)

            if (j >= v [i - 1])

                dp [j] = min (dp [j], dp [j - v [i - 1]] + w [i - 1]);



    int ret = 0;

    for (int j = 0; j <= 100000; j++)

        if (dp [j] <= W)

            ret = max (ret, j);



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





#ifdef LOCALHOST

	cerr << "time: " << (int64) clock () * 1000 / CLOCKS_PER_SEC << " ms" << endl;

#endif

    return 0;

}