/*---------------------------------
 *File name: asd.cpp
 *Team: 这题太简单啦
 *Author: Snpilola
 *Creation date: 2019-11-09 16:48
 *-------------------------------*/
#include<map>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<string>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define LL long long
#define mkp make_pair
#define PLL pair<LL, LL>
#define lowbit(x) x & (-x)
#define PII pair<int, int>
#define Pque priority_queue 
using namespace std;
const int maxn = 1e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int EPS = 1e-6;

LL dp[maxn];
LL v[maxn], w[maxn];
LL ans = 0;

int main(){
	LL n, W;
	memset(dp, inf, sizeof dp);
	dp[0] = 0;
	scanf("%lld %lld", &n, &W);
	for(int i = 1; i <= n; ++i) scanf("%lld %lld", &w[i], &v[i]);
	for(int i = 1; i <= n; ++i){
		for(int j = maxn; j >= v[i]; --j){
			dp[j] = min(dp[j], dp[j - v[i]] + w[i]);
		}
	}
	for(int i = 1; i <= maxn; ++i) if(dp[i] <= W) ans = max(ans, (LL)i);
	printf("%lld\n", ans);
	return 0;
}