type t = { v : int; w : int }

let () =
  let (n, w) = Scanf.scanf "%d %d " (fun n w -> n, w) in
  let a = Array.init n (fun _ -> Scanf.scanf "%d %d " (fun v w -> { v; w })) in
  let z = (100*n + 1) in
  let dp = Array.make z (w + 1) in
  dp.(0) <- 0;
  for i = 0 to n - 1 do
    for j = z - 1 downto a.(i).v do
      if dp.(j - a.(i).v) + a.(i).w < dp.(j) then dp.(j) <- dp.(j - a.(i).v) + a.(i).w
    done
  done;
  let rec print i =
    if i < 0 then assert false
    else if dp.(i) <= w then Printf.printf "%d\n" i
    else print (i - 1) in
  print (z - 1)