fun main(args: Array<String>) {
    val (N, W) = readIntegerList()
    val  INF = W + 1
    val dp = Array(N + 1) { IntArray(100000 + 1) { INF } }
    dp[0][0] = 0
    for (i in 0 until N) {
        val (w, v) = readIntegerList()
        for (j in 0..100000) {
            if (0 <= j - v) {
                dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j - v] + w)
            }
            dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j])
        }
    }
    var ans = 0
    for (v in dp[N].indices) {
        if (dp[N][v] <= W) ans = v
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
