fun main(args: Array<String>) {
    val s = readLine()!!.split(' ')
    val n = s[0].toInt()
    val mw = s[1].toLong()

    val dp = Array(100001) { 1000000001L }
    dp[0] = 0L

    for (i in 0 until n) {

        val (s1, s2) = readLine()!!.split(' ')
        val w = s1.toLong()
        val v = s2.toInt()

        for (tv in 100000 downTo 0) {
            if (tv - v >= 0) {
                dp[tv] = Math.min(dp[tv], dp[tv - v] + w)
            }
        }
    }

    var res = 0

    dp.forEachIndexed { v, w ->
        if (w <= mw) {
            res = v
        }
    }

    println(res)
}
