fun main(args: Array<String>) {
    edpe()
}

fun edpe() {
    val (n, weightLimit) = readLine()!!.split(" ").map { it.toInt() }
    val items = (1..n)
        .map { readLine()!!.split(" ").map { it.toInt() }.let { ItemE(it[0], it[1]) } }

    val inf = Long.MAX_VALUE / 100
    val dp = Array(n + 1) { LongArray(101010) { inf } }
    dp[0][0] = 0

    for (i in items.indices) {
        val (weight, value) = items[i]
        for (j in 0..100000) {
            dp[i + 1][j] = Math.min(dp[i + 1][j], dp[i][j])
            if (j + value <= 100000) dp[i + 1][j + value] = Math.min(dp[i + 1][j + value], dp[i][j] + weight)
        }
    }

    val answer = dp[n].indexOfLast { it <= weightLimit }

    println(answer)
}

private data class ItemE(val weight: Int, val value: Int)
