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

V_SUM = V.inject(:+)
V_MAX = N * V_SUM

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

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

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

puts ans