object Main extends App {

  import scala.io.StdIn._

  val Array(n, weightMax) = readLine.trim.split(' ').map(_.toInt)
  val minWeights = Array.tabulate(n * 1000 + 1){_ ⇒ Long.MaxValue}.also{arr ⇒ arr(0) = 0L}
  for (_ ← 0 until n){
    val Array(w, v) = readLine.trim.split(' ').map(_.toInt)
    for (prev ← (0 until minWeights.length - v).reverse) {
      if (minWeights(prev + v) - w > minWeights(prev) && weightMax - w >= minWeights(prev)) {
        minWeights(prev + v) = minWeights(prev) + w
      }
    }
  }
  println(minWeights.indices.filter(p ⇒ minWeights(p) <= weightMax).max)
  case class Goods(weights: Long, value: Long)
  implicit class Extend[T](value: T){
    def also(func: T ⇒ Unit): T = {func(value); value}
    def let[A](func: T ⇒ A): A = func(value)
  }
}