fun main(args: Array<String>) {
    val init = 10000000000L
    val (N, W) = readLine()!!.split(" "). map { it.toInt() }
    var dp = LongArray(100001) {init}
    dp[0] = 0
    for(i in 0 until N) {
        val dp2 = dp.clone()
        val (w, v) = readLine()!!.split(" "). map { it.toLong() }
        val v2 = v.toInt()
        for (j in 0 .. 100000) {
            if (dp[j] != init) dp2[j + v2] = Math.min(dp[j + v2], dp[j] + w)
        }
        dp = dp2
    }
    for (i in 100000 downTo 0) {
        if (dp[i] <= W) {
            println("$i")
            return
        }
    }
}