N, W = gets.split.map(&:to_i)

max_v = N * 1000
goods = N.times.map { gets.split.map(&:to_i) }

dp = Array.new(max_v + 1, Float::INFINITY)
dp[0] = 0

goods.each do |w, v|
  (max_v).downto(0) do |i|
    next if dp[i] > W

    nw = dp[i] + w
    next if nw > W

    nv = i + v
    dp[nv] = nw if dp[nv] > nw
  end
end

puts dp.rindex { |w| w <= W }
