n,w=gets.split.map(&:to_i)
wv=n.times.map{gets.split.map(&:to_i)}
v=wv.inject(0){|sum,a| sum+a[1]}
wv.unshift([])
d=Array.new(n+1){Array.new(v+1,v+1)}
d[0][0]=0
1.upto(n){|i| 0.upto(v){|l| 
  d[i][l]=d[i-1][l]
  d[i][l]=d[i-1][l-wv[i][1]]+wv[i][0] if d[i][l]>d[i-1][l-wv[i][1]]+wv[i][0]  
  }}
ans=0
0.upto(v){|l|
  ans=l if d[n][l]<=w
  }
puts ans