import std.algorithm, std.stdio;

void main() {
  long N, W;
  readf(" %d %d ", &N, &W);
  
  auto weights = new long[N];
  auto values  = new long[N];
  
  foreach (i; 0..N) {
    readf(" %d %d ", &weights[i], &values[i]);
  }
  
  const V = values.sum;
  
  long[][] dp;
  dp.length = N+1;
  foreach (ref x; dp) x.length = V+1;
  
  foreach (ref x; dp) x[] = long.max/2;
  dp[0][0] = 0;
  
  foreach (i; 0..N) foreach (j; 0..V+1) {
    if (j - values[i] >= 0) dp[i+1][j] = min(dp[i+1][j], dp[i][j-values[i]]+weights[i]);
    dp[i+1][j] = dp[i+1][j].min(dp[i][j]);
  }
  
  foreach_reverse (v; 0..V+1) {
    if (dp[N][v] <= W) {
      v.writeln;
      break;
    }
  }
}
