# frozen_string_literal: true

n, w = gets.split.map(&:to_i)

max_value = n * 10**3
table = Array.new(max_value + 1, Float::INFINITY)
table[0] = 0

value_limit = 0
n.times do
  weight, value = gets.split.map(&:to_i)

  (0..value_limit).each do |val|
    if table[val] + weight < table[val + value] && table[val] + weight <= w
      table[val + value] = table[val] + weight
      value_limit = val + value if value_limit < val + value
    end
  end
end

puts value_limit
