#include <bits/stdc++.h>
using namespace std;

int w[100005],v[100005],dp[100005],ans=0,V=100000;
const int INF = 0x3f3f3f3f;

int main()
{
	int W,n;
	cin >> n >> W;
	for(int i = 1; i <= n; i++)
		cin >> w[i] >> v[i];
	
	memset(dp,INF,sizeof(dp));
	dp[0]=0;

	for(int i = 1; i <= n; i++)
	{
		for(int j = V; j >= v[i]; j--)
		{
			dp[j] = min(dp[j], dp[j-v[i]] + w[i]);

			if(dp[j]<=W)
				ans = max(ans,j);
		}
	}

	cout << ans << endl;
	return 0;
}