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

using ll = long long;
const ll INF = 1e18 + 5;



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int n,W,w,v;
    cin>>n>>W;
    vector<ll> dp(100001,INF);
    dp[0] = 0;
    for(int i=0;i<n;i++){
		cin>>w>>v;
		for(int j=100000;j>=v;j--){
			dp[j] = min(dp[j],dp[j-v] + w);
		}	
	}
	ll ans = 0;
	for(int i=0;i<=100000;i++){
		if(dp[i]<=W)
			ans = i;
	}
	cout<<ans;
    return 0;
}







