fun main(args: Array<String>) {

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

    var maxVal = 100001

    var dp = Array(N){LongArray(maxVal+1){ Long.MAX_VALUE/2}}
    var w = LongArray(N)
    var v = IntArray(N)

    for(i in 0 until N){
        val(wi,vi) = readLine()!!.split(" ")
        w[i] = wi.toLong()
        v[i] = vi.toInt()
    }

    for(j in 0..v[0]){
        dp[0][j] = w[0]

    }
    var ans = 0

    for(i in 1 until N){
        for(j in 0..maxVal){

            if(v[i] >= j) {
                dp[i][j] = Math.min(dp[i-1][j],w[i])
            } else {
                dp[i][j] = Math.min(dp[i-1][j],dp[i-1][j-v[i]] + w[i])
            }



        }

    }
    for(i in 0 until N){
        for(j in 0 until maxVal+1){
            if(dp[i][j] <= W){
                ans = Math.max(ans,j)
            }
        }

    }

    println(ans)

}
