INF = 10**12
MAXV = 1100 * 100
N, W = gets.split.map(&:to_i)
lists = []
N.times do
  lists << gets.split.map(&:to_i)
end
# p lists
dp = Array.new(MAXV, INF)
dp[0] = 0
N.times do |i|
  (MAXV - 1).downto(lists[i][1]) do |j|
    # dp[j] = [dp[j], dp[j - lists[i][1]] + lists[i][0]].min
    dp[j] = dp[j - lists[i][1]] + lists[i][0] if dp[j] > dp[j - lists[i][1]] + lists[i][0]
  end
end
# binding.pry
(MAXV - 1).downto(0) do |i|
  if dp[i] <= W
    puts i
    exit
  end
end