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

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

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

    val maxN = 101
    val maxValue = numberOfItems * 1000

    // dp[品物の数][価値の総和] = 価値の総和以上になるよう品物をi個選んだときの重量の最小値
    val dp = Array(maxN + 1) { LongArray(maxValue + 1) { Long.MAX_VALUE / 2 } }

    dp[0][0] = 0

    for (i in 0 until numberOfItems) {
        for (sumValue in 0..maxValue) {
            val item = items[i]

            if (sumValue - item.value >= 0) {
                dp[i + 1][sumValue] = Math.min(
                    dp[i + 1][sumValue],
                    dp[i][sumValue - item.value] + item.weight
                )
            }
            dp[i + 1][sumValue] = Math.min(dp[i + 1][sumValue], dp[i][sumValue])
        }
    }

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

    println(answer)
}
