n,wmax=gets.split.map(&:to_i)
vmax=1001
all=[]
n.times.each do
    all<<gets.split.map(&:to_i)
end
dp=Array.new(101){[100000000000000]*1010}
dp[0][0]=0
for i in 0..n-1
    wi,vi=all[i]
    #p wi
    for v in 0..vmax
      if v-vi>=0
        dp[i+1][v]=[dp[i][v-vi]+wi,dp[i][v]].min
     else
        dp[i+1][v]=dp[i][v]
        end
    end
end
#p dp[0..1]
result=100000000
for i in 0..vmax
    if dp[n][i]<=wmax
        result=i
    end
end
p result