fun main(args : Array<String>) {
    val (n, w) = readLine()!!.split(" ").map { it.toInt() }
    val ww = mutableListOf<Int>()
    val vv = mutableListOf<Int>()

    ww.add(0)
    vv.add(0)

    repeat(n) {
        val (w1, v1) = readLine()!!.split(" ").map { it.toInt() }
        ww.add(w1)
        vv.add(v1)
    }

    val vMax = 1000*n
    val dp = Array(n+1) { LongArray(vMax+1){ Int.MAX_VALUE * 100L } }

    dp[0][0] = 0

    for (idx in 0 until n) {
        for (vSum in 0..vMax) {
            if (vv[idx+1] <= vSum) {
                dp[idx+1][vSum] = Math.min(dp[idx][vSum], dp[idx][vSum-vv[idx+1]] + ww[idx+1])
            } else {
                dp[idx+1][vSum] = dp[idx][vSum]
            }
        }
    }

    /*
    dp.forEach {
        println(it.toList())
    }
     */

    var ans = 0
    for (i in 0..vMax) {
        if (dp[n][i] <= w) {
            ans = i
        }
    }

    println(ans)
}