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(N + 1) { Array.new(V_MAX + 1, Float::INFINITY) }
dp[0][0] = 0

1.upto(N) do |i|
  v = V[i-1]
  w = W[i-1]
  0.upto(V_MAX) do |sum_v|
    if sum_v >= v
      dp[i][sum_v] = [dp[i-1][sum_v], dp[i-1][sum_v - v] + w].min
    else
      dp[i][sum_v] = dp[i-1][sum_v]
    end
  end
end

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

puts ans