N, W = gets.chomp.split.map(&:to_i)
a = []
N.times do |i|
  a[i] = gets.chomp.split.map(&:to_i)
end
INF = 10**10

dp = Array.new(105) { Array.new(10**3 + 5, INF) }
dp[0][0] = 0

1.upto(N) do |i|
  w, v = a[i-1]
  1.upto(1000) do |j|
    # 選ぶ
    if j >= v
      dp[i][j] = [dp[i][j], dp[i-1][j-v] + w].min
    end
    # 選ばない
    dp[i][j] = [dp[i][j], dp[i-1][j]].min
  end
end
ans = 0
dp[N].each.with_index do |e, i|
  if e <= W
    ans = i
  end
end
p ans
