object Main {
  def main(args: Array[String]): Unit = {
    val (num, limit) = {
      val nw = io.StdIn.readLine().split(" ").map(_.toInt)
      (nw(0), nw(1))
    }
    val items = new Array[(Int, Int)](num)
    for (i <- 0 until num) {
      val vw = io.StdIn.readLine().split(" ").map(_.toInt)
      items(i) = (vw(0), vw(1))
    }

    val dp = solve(limit, items)
    val max =
      dp(num)
        .zipWithIndex
        .collect { case (w, v) if w <= limit => v }
        .max
    println(max)
  }

  def solve(weightLimit: Int, items: Array[(Int, Int)]): Array[Array[Int]] = {
    val length = items.length
    val maximum = length * MaxValue
    val dp = Array.ofDim[Int](length + 1, maximum + 1)
    for (i <- 1 to maximum) {
      dp(0)(i) = weightLimit + 1
    }
    dp(0)(0) = 0

    items.zipWithIndex.foreach { case ((v, w), i) =>
      for (limit <- 0 to maximum) {
        if (v <= limit && dp(i)(limit) > dp(i)(limit - v) + w) {
          dp(i + 1)(limit) = dp(i)(limit - v) + w
        } else {
          dp(i + 1)(limit) = dp(i)(limit)
        }
      }
    }
    dp
  }

  val MaxValue = 100
}