N,W=gets.split.map(&:to_i)
b=N.times.map{gets.split.map(&:to_i)}.transpose
vmax=b[1].max*N
inf = 10.0/0
dp=Array.new(N){Array.new(vmax,inf)}#minW

for i in 0..N-1#date
    for j in 0..vmax-1
        if i==0
            dp[i][j]=b[0][i] if j<=b[1][i]
        elsif j-b[1][i]>0
            dp[i][j]=dp[i-1][j-b[1][i]]+b[0][i] > dp[i-1][j] ? dp[i-1][j] : dp[i-1][j-b[1][i]]+b[0][i]
        else  
            dp[i][j]=dp[i-1][j]
        end
    end
end
sum=0
for i in 0..vmax-1
    if dp[N-1][i]<=W  
        sum=i if i>sum
    end
end
puts sum+1