object Main extends App {
  val Array(n, lim) = io.StdIn.readLine().split(' ').map(_.toInt)
  val items = Array.fill(n)(io.StdIn.readLine().split(' ').map(_.toInt))
  val sumOfValue = items.map(_(1)).sum
  val dp: Array[Array[Int]] = Array.fill(n+1)(Array.fill(sumOfValue+1)(Int.MaxValue))
  dp(0)(0) = 0

  for (i <- 0 until n)
    for (v <- (0 to sumOfValue).filter(dp(i)(_) != Int.MaxValue)) {
      val nWeight = dp(i)(v) + items(i)(0)
      if (nWeight <= lim && nWeight < dp(i+1)(v+items(i)(1))) dp(i+1)(v+items(i)(1)) = nWeight
      if (dp(i)(v) < dp(i+1)(v)) dp(i+1)(v) = dp(i)(v)
    }

  println(dp(n).indices.reverse.dropWhile(dp(n)(_) == Int.MaxValue).head)
}