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

wv = Array.new(n){ gets.split.map &:to_i }

V_MAX = wv.map{ |x| x[1] }.inject(:+)

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

s_v = 0
s_w = 0

(1..n).each.with_index(0){ |nn, i| 
	temp_w = wv[i][0]
	temp_v = wv[i][1]

	s_v += temp_v
	s_w += temp_w

	s_v.downto(temp_v + 1).each{ |vv|
		temp = weights[vv - temp_v] + temp_w
		if weights[vv] > temp then
			weights[vv] = temp
		end
	}
	
	temp_v.downto(0).each{ |vv|
		if weights[vv] > temp_w then
			weights[vv] = temp_w
		end
	}
}

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

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