import java.util.*
import kotlin.math.*

fun main() {
    val (n, w) = readIntList()
    val weight = MutableList(n) { 0 }
    val value = MutableList(n) { 0 }
    repeat(n) {
        val (tw, tv) = readIntList()
        weight[it] = tw
        value[it] = tv
    }

    val vMax = 100000
    val dp = List(n + 1) { MutableList(vMax + 1) { Long.MAX_VALUE / 2} }
    dp[0][0] = 0L

    for (i in 1..n) {
        for (j in 0..vMax) {
            dp[i][j] = if (j >= value[i - 1]) {
                min(dp[i - 1][j - value[i - 1]] + weight[i - 1], dp[i - 1][j])
            } else {
                dp[i - 1][j]
            }
        }
    }

    var ans = vMax
    while (dp[n][ans] > w) ans--
    println(ans)
}


fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
