N, W = gets.split.map(&:to_i)
dp = Array.new(1000 * N + 1) do 10000000000 end # value
dp[0] = 0
N.times do
  w, v = gets.split.map(&:to_i)
  (1000 * N).downto(v) do |i|
    dp[i] = [dp[i], dp[i - v] + w].min
  end
end
puts (dp.rindex do |w| w <= W end)