N, W_MAX = gets.split.map(&:to_i)
W, V = N.times.map { gets.split.map(&:to_i) }.transpose
V_MAX = 100001

dp = Array.new(V_MAX + 1, V_MAX)
dp[0] = 0

1.upto(N) do |i|
  v = V[i-1]
  w = W[i-1]
  V_MAX.downto(v) do |sum_v|
    cur_w = dp[sum_v - v] + w
    dp[sum_v] = cur_w if cur_w < dp[sum_v]
  end
end

ans = V_MAX
0.upto(V_MAX) do |v|
  ans = v if W_MAX >= dp[v]
end

puts ans