N,W = gets.split.map(&:to_i)
V = N*10**3
dp = [10**12]*(V+1)
dp[0] = 0
N.times do
  w,v = gets.split.map(&:to_i)
  V.downto(v) do |i|
    a,b=dp[i-v]+w,dp[i]
    dp[i] = a if a < b
  end
end
ans = V
#p dp
while dp[ans] > W
  ans-=1
end
p ans