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

const int V = 100000;
const int INF = 0x3f3f3f3f;

int n,m,w[100005],v[100005];
int ans;
int f[100005];

int main()
{
	memset(f,INF,sizeof(f));
	f[0] = 0;
	cin>>n>>m;
	for(int i=1;i<=n;cin>>w[i]>>v[i],i++);
	for(int i=1;i<=n;i++)
		for(int j=V;j>=v[i];j--)
		{
			f[j] = min(f[j],f[j-v[i]]+w[i]);
			if(f[j]<=m)
				ans = max(ans,j);
		}
	cout<<ans<<endl;
	
	return 0;
}