[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reada f = stdin.ReadLine().Split() |> Array.map f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

[<EntryPoint>]
let main _ =
    let [n;w] = reads int
    let wvs = Array.init n (fun _ -> reads int)
    let vmax = pown 10 5
    let inf = pown 10 9 + 7

    let dp = Array2D.create (n + 1) (vmax + 1) inf
    dp.[0, 0] <- 0
    for i = 1 to n do
        let [iw;iv] = wvs.[i-1]
        for j = 0 to vmax do
            if j - iv < 0 then
                dp.[i, j] <- dp.[i-1, j]
            else
                dp.[i, j] <- min (dp.[i-1, j]) (dp.[i-1, j-iv] + iw)

    let mutable res = 0
    for i = 0 to vmax do
        if dp.[n, i] <= w then
            res <- max res i
    printfn "%i" res

    0