#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>

using namespace std;
typedef long long ll;

const int MAXN = 1e5 + 100;
const int inf = 0x3f3f3f3f;
ll n, k;
ll dp[MAXN];
ll w[MAXN];
ll v[MAXN];
ll ans;

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