'use strict'

const INF = 900719925474099 // Number.MAX_SAFE_INTEGER / 10;

function Main(input){
	let temp = input.trim().split('\n');
	let temp2 = temp[0].split(' ').map((v)=>parseInt(v));
	let n = temp2.shift();
	let w = temp2.shift();
	let wv = new Array(n+10);

	for(let i=0;i<n;i++){
		wv[i] = temp[i+1].split(' ').map((v)=>parseInt(v));
	}

	let dp = [...new Array(n+10)].map(()=>(new Array( n*1000 + 10).fill(INF)));
	
	//初期化
	dp[0][0] = 0;

	//console.log(wv);
	//もらうDP
	for(let i=0;i<n;i++){
		//console.log('-------------------------',i);
		for(let j=0,l=dp[0].length;j<l;j++){
			//入れる
			if(j - wv[i][1] >= 0){
				//console.log("in:",dp[i+1][j], dp[i][j - wv[i][1]] + wv[i][0],wv[i][1],wv[i][0]);
				dp[i+1][j] = Math.min(dp[i+1][j], dp[i][j - wv[i][1]] + wv[i][0]);
			}
			//入れない
			//console.log("out:",dp[i+1][j], dp[i][j],wv[i][1],wv[i][0]);
			dp[i+1][j] = Math.min(dp[i+1][j],dp[i][j]);
		}
	}
	//console.log(dp);
	let max = 0;
	for(let i=dp[n].length-1;i>=1;i--){
		if( dp[n][i] <= w ){
			max = i;
			break;
		}
	}
	console.log(max);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
