object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val N, W = sc.nextInt()
    val w, v = new Array[Int](N)
    (0 until N) foreach { i =>
      val _w, _v = sc.nextInt()
      w(i) = _w
      v(i) = _v
    }
    val VMAX = Math.pow(10, 3).toInt
    val Inf = Long.MaxValue / 10

    val dp = Array.fill(N+1, VMAX+1)(Inf)
    dp(0)(0) = 0L
    var i = 0
    while (i < N) {
      var j = 0
      while (j <= VMAX) {
        if (j >= v(i))
          dp(i+1)(j) = (dp(i)(j - v(i)) + w(i)) min dp(i+1)(j) min dp(i)(j)
        else
          dp(i+1)(j) = dp(i+1)(j) min dp(i)(j)
        j += 1
      }
      i += 1
    }
    
    println(dp(N).lastIndexWhere(_ <= W))
  }

}
