local n,m=io.read("n","n")
local w,v={},{}
for i=1,n do
    w[i],v[i]=io.read("n","n")
end

local INF=10^13
local dp={}
for i=1,n+1 do
    dp[i]={}
    for j=0,10^5 do
        dp[i][j]=INF
    end
end
dp[1][0]=0

for i=1,n do
    for j=0,10^5 do
        if j-v[i]>=0 then
            dp[i+1][j]=math.min(dp[i+1][j],dp[i][j-v[i]]+w[i])
        end
        dp[i+1][j]=math.min(dp[i+1][j],dp[i][j])
    end
end

local max=0
for i=0,10^5 do
    if dp[n+1][i]<=m then
        max=i
    end
end
print(max)