// 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.5451485681692505x):
#include <bits/stdc++.h>

using namespace std;



int main() {

int n, w;

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

vector<int > wt(n), val(n);

long long valm =0, ans=0;

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

	scanf("%d %d",&wt[i] , &val[i]);

	valm+=val[i];

}





vector< vector< long long> > dp(n+1, vector<long long> (valm+1));

dp[0][0]=0;

for(int i=1; i<=valm; ++i) dp[0][i]=1e18;





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

	for(long long j=1; j<=valm; ++j){

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

		if(val[i-1]<=j){

			dp[i][j] = min(dp[i][j], dp[i-1][j-val[i-1]] + wt[i-1]);

		}

		

		if(dp[i][j]<=w) ans = max(ans,j);

	}

}



printf("%ld\n", ans);

	

	



	return 0;

}