n, lw = gets.split.map(&:to_i)
lv = 10**5
dp = Array.new(n + 1) { Array.new(lv + 1) { Float::INFINITY } }
dp[0][0] = 0

1.upto(n) do |i|
  w, v = gets.split.map(&:to_i)

  0.upto(lv) do |j|
    if v <= j
      dp[i][j] = [dp[i - 1][j - v] + w, dp[i - 1][j]].min
    else
      dp[i][j] = dp[i - 1][j]
    end
  end
end

puts dp[n].rindex { |e| e <= lw }
