# 25:50 - 
n, W_LIMIT = gets.to_s.split.map{|t| t.to_i }
wv = Array.new(n){ gets.to_s.split.map{|t| t.to_i } }.sort_by{|_, v| v }

V_MAX = (10 ** 3) * n

dp = Array.new(V_MAX+1){ (10**9) * n + 1 }
dp[0] = 0

v_sum = 0
wv.each do |(w_i, v_i)|
  v_sum = V_MAX < v_sum + v_i ? V_MAX : v_sum + v_i
  v_sum.downto(v_i) do |v|
    dp[v] = dp[v-v_i] + w_i if dp[v] > dp[v-v_i] + w_i
  end
end

v_sum.downto(0) do |v|
  if dp[v] <= W_LIMIT
    puts v
    exit
  end
end
