n, w = gets.split.map &:to_i

ws = []
vs = []

n.times {
	w_temp,v_temp = gets.split.map &:to_i
	ws << w_temp
	vs << v_temp
}

V_MAX = vs.inject(:+)
W_MAX = ws.inject(:+)

# index値の価値を達成するのに必要な最低重量
weights = Array.new(V_MAX + 1, W_MAX)

(1..n).each.with_index(0){ |nn, i| 
	vs[i].upto(V_MAX).each.with_index(0){ |vv, j|
		temp = weights[vv] - ws[i]
		if weights[vv - vs[i]] > temp then
			weights[vv - vs[i]] = temp
		end
	}
}

index = weights.bsearch_index{ |x| x > w}

if index == nil then
	if weights.last == w then
		puts weights.size - 1
	else 
		puts 0
	end
else
	puts index -1
end
