#include <bits/stdc++.h>
using namespace std;
const long long LINF = 1001002003004005006ll;
const int MX = 200005;
long long dp[MX];
int main()
{
	int n,w;
	cin >> n >> w;
	for(int i = 0; i < MX; ++i) dp[i] = LINF;
	dp[0] = 0;
	for(int i = 0; i < n; ++i)  
	{
		int a,b;
		cin >> a >> b;
		for (int j=MX-b-1; j>=0; --j) 
			dp[j+b] = min(dp[j+b], dp[j]+a);
	}
	int ans = 0;
	for(int i = 0; i < MX; ++i)
		if (dp[i] <= w) ans = i;
	cout<<ans<<endl;
	return 0;
}