INF = Float::INFINITY
N, W = gets.chomp.split.map(&:to_i)

wv_array = []
N.times do |n|
  w_i, v_i = gets.chomp.split.map(&:to_i)

  wv_array << { w: w_i, v: v_i }
end

max_v = wv_array.sum { |wv| wv[:v] }

dp = []
(N+1).times do |n|
  dp << [INF] * (max_v + 1)
end

dp[0][0] = 0

wv_array.each.with_index(0) do |wv, i|
  0.upto(max_v) do |v|
    w_i, v_i = wv.values
    if v - v_i >= 0
      dp[i+1][v] = dp[i][v - v_i] + w_i if dp[i+1][v] > dp[i][v - v_i] + w_i
    end

    dp[i+1][v] = dp[i][v] if dp[i+1][v] > dp[i][v]
  end
end

result = 0
0.upto(max_v) do |v|
  result = v if dp[N][v] <= W
end

puts result