fun main(args: Array<String>) {

    var (N,W) = readLine()!!.split(" ").map{it.toInt()}

    var maxVal = 100000;

    var dp = Array(maxVal+1){ Long.MAX_VALUE /2}
    
    dp[0] = 0;

    for(i in 1..N){
        val (ws,vs) = readLine()!!.split(" ")
        val w = ws.toInt()
        val v = vs.toLong()
        for(sumv in maxVal downTo 0){
            if(sumv - v >= 0){
                dp[sumv] = Math.min(dp[sumv],dp[sumv- v.toInt()] + w)
            }
        }

    }
    var ans = 0;

    for(sum_v in 0 until maxVal+1){
        if(dp[sum_v]<= W){
            ans = sum_v
            //println(ans)
        }
    }

    println(ans)

}
