'use strict';
console.log(function(args){
  const tmp = args.trim().split('\n').map( r=>r.split(' ').map(v=>v|0) );
  const N = tmp[0][0], W = tmp[0][1];
  const Vmax = N * 1000;
  const dp = [Array(Vmax+1).fill(Infinity)];
  dp[0][0] = 0;
  for ( let i = 0; i < N; i++ ) {
    let w = tmp[i+1][0];
    let v = tmp[i+1][1];
    dp.push(Array(Vmax+1).fill(Infinity));
    for ( let j = 0; j <= Vmax; j++ ) {
      if ( j >= v ) dp[i+1][j] = Math.min( dp[i][j], dp[i][j-v] + w );
      else dp[i+1][j] = dp[i][j];
    }
  }
  for ( let i = Vmax; i > 0; i-- ) if ( dp[N][i] <= W ) return i;
}(require('fs').readFileSync('/dev/stdin', 'utf8')));
