import Foundation

func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}

func main() {
    let nw = readWords { Int($0)! }
    let n = nw[0]
    let w = nw[1]

    var items = [(w: Int, v: Int)]()
    var totalWeight = 0
    var totalValue = 0
    for _ in 1...n { 
        let wv = readWords { Int($0)! }
        items.append((w: wv[0], v: wv[1]))
        totalWeight += wv[0]
        totalValue += wv[1]
    }

    // ある価値での最小の重さ
    var dp = [Int](repeating: totalWeight, count: totalValue+1)
    dp[0] = 0
    
    for i in 0..<n {
        let item = items[i]
        for value in (0...totalValue).reversed() {
            if value + item.v <= totalValue { 
                dp[value+item.v] = min(dp[value+item.v], dp[value]+item.w)
            }
        }
    }

    let ans = dp.enumerated().filter { $0.1 <= w }
    print(ans.last!.0)
}


main()