local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) local n=dimension local m={default_val and {__index=function()return default_val end}}for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local N, W = read.nn()
local w, v = {}, {}
for i=1,N do
    w[i], v[i] = read.nn()
end
local tbl = array(2, 10^10)
tbl[0][0] = 0
for i=0,N-1 do
    local nw, nv = w[i+1], v[i+1]
    for j=0,100000 do
        if tbl[i+1][j] > tbl[i][j] then
            tbl[i+1][j] = tbl[i][j]
        end
        if tbl[i+1][j+nv] > tbl[i][j] + nw then
            tbl[i+1][j+nv] = tbl[i][j] + nw
        end
    end
end
local ans = 0
for j=0,100000 do
    if tbl[N][j] <= W then
        ans = math.max(ans, j)
    end
end
print(ans)