open System

let INF = 1000000007L
let N,W =stdin.ReadLine().Split()|>fun c -> int c.[0],int64 c.[1]
let w = Array.create N 0L
let v = Array.create N 0
[<EntryPoint>]
let main argv =
    for i in [0..N-1] do
        let input = stdin.ReadLine().Split()|>Array.map int64
        w.[i] <- input.[0]
        v.[i] <- (input.[1]|>int)
    let dp = Array2D.create (N+1) (1000*N+1) INF
    for i in [0..N] do dp.[i,0] <- 0L
    for i in[1..N] do
        for j in [0..(1000*N)] do
            dp.[i,j] <- if (j-v.[i-1])<0 then dp.[i-1,j] else min dp.[i-1,j] (dp.[(i-1),(j-v.[i-1])]+w.[i-1])
    let ans = Array.create (1000*N+1) 0
    for i in [0..(1000*N)] do
        ans.[i] <- if dp.[N,i]<=W then i else 0
    Array.max ans
    |>stdout.WriteLine
    0