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
        c=j-b[1][i]
        e=dp[i-1][j]
        if i==0
            dp[i][j]=b[0][i] if j<=b[1][i]
        elsif c>=0
            
            dp[i][j]=(dp[i-1][c]+b[0][i] > e ? e : dp[i-1][c]+b[0][i])
        else  
            dp[i][j]=e
        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