n, w_max = gets.split.map(&:to_i)
items = Array.new(n){gets.split.map(&:to_i)}
dp = Array.new(100000, Float::INFINITY)
dp[0] = 0
items.each do |w, v|
  prev = dp.dup
  prev.each_with_index do |pw, pv|
    if pw+w <= w_max && pw+w < prev[pv+v]
      dp[pv+v] = pw+w
    end
  end
end
puts dp.rindex{|v| v != Float::INFINITY}
